<p>sungtae kim has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10869">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Support separated HTTP request<br><br>Currently, the Asterisk does not support seperated HTTP request.<br><br>This patch make the Asterisk enables to wait lest part of HTTP request.<br>Also increases acceptable HTTP body length to 40k to support more<br>larger request.<br><br>Change-Id: I48a401aa64a21c3b37bf3cb4e0486d64b7dd8aa1<br>---<br>M main/http.c<br>1 file changed, 20 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/69/10869/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/http.c b/main/http.c</span><br><span>index dcf90ae..e53bc16 100644</span><br><span>--- a/main/http.c</span><br><span>+++ b/main/http.c</span><br><span>@@ -82,7 +82,7 @@</span><br><span> </span><br><span> /*! Maximum application/json or application/x-www-form-urlencoded body content length. */</span><br><span> #if !defined(LOW_MEMORY)</span><br><span style="color: hsl(0, 100%, 40%);">-#define MAX_CONTENT_LENGTH 4096</span><br><span style="color: hsl(120, 100%, 40%);">+#define MAX_CONTENT_LENGTH 40960</span><br><span> #else</span><br><span> #define MAX_CONTENT_LENGTH 1024</span><br><span> #endif    /* !defined(LOW_MEMORY) */</span><br><span>@@ -916,14 +916,29 @@</span><br><span> static int http_body_read_contents(struct ast_tcptls_session_instance *ser, char *buf, int length, const char *what_getting)</span><br><span> {</span><br><span>      int res;</span><br><span style="color: hsl(120, 100%, 40%);">+      int total;</span><br><span> </span><br><span>       /* Stream is in exclusive mode so we get it all if possible. */</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_iostream_read(ser->stream, buf, length);</span><br><span style="color: hsl(0, 100%, 40%);">-   if (res < length) {</span><br><span style="color: hsl(0, 100%, 40%);">-          ast_log(LOG_WARNING, "Short HTTP request %s (Wanted %d)\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                   what_getting, length);</span><br><span style="color: hsl(120, 100%, 40%);">+        total = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+    while(1) {</span><br><span style="color: hsl(120, 100%, 40%);">+            res = ast_iostream_read(ser->stream, buf + total, length);</span><br><span style="color: hsl(120, 100%, 40%);">+         if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   break;</span><br><span style="color: hsl(120, 100%, 40%);">+                }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           total += res;</span><br><span style="color: hsl(120, 100%, 40%);">+         if (total >= length) {</span><br><span style="color: hsl(120, 100%, 40%);">+                     break;</span><br><span style="color: hsl(120, 100%, 40%);">+                }</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+     ast_log(LOG_DEBUG, "Received message. buf[%s]\n", buf);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (total != length) {</span><br><span style="color: hsl(120, 100%, 40%);">+                ast_log(LOG_WARNING, "Wrong HTTP content read. Request %s (Wanted %d, Read %d)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                  what_getting, length, res);</span><br><span>          return -1;</span><br><span>   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  return 0;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10869">change 10869</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10869"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I48a401aa64a21c3b37bf3cb4e0486d64b7dd8aa1 </div>
<div style="display:none"> Gerrit-Change-Number: 10869 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: sungtae kim <pchero21@gmail.com> </div>