<p>Friendly Automation <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11063">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Sean Bright: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Revert "http.c: Support separated HTTP request"<br><br>This reverts commit 148ddfba9afc83b102fadabecf67d48a65e30e4a.<br><br>Reason for revert: Under 13 this change appears to break HTTP<br>body processing, causing test failures and problems.<br><br>Change-Id: Ica47ca2cac1b21c6ef907c1ffbfaf2cebdea8e80<br>---<br>M main/http.c<br>1 file changed, 11 insertions(+), 29 deletions(-)<br><br></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 cf2ff5e..136c916 100644</span><br><span>--- a/main/http.c</span><br><span>+++ b/main/http.c</span><br><span>@@ -84,18 +84,11 @@</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 40960</span><br><span style="color: hsl(120, 100%, 40%);">+#define MAX_CONTENT_LENGTH 4096</span><br><span> #else</span><br><span> #define MAX_CONTENT_LENGTH 1024</span><br><span> #endif /* !defined(LOW_MEMORY) */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/*! Initial response body length. */</span><br><span style="color: hsl(0, 100%, 40%);">-#if !defined(LOW_MEMORY)</span><br><span style="color: hsl(0, 100%, 40%);">-#define INITIAL_RESPONSE_BODY_BUFFER 1024</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-#define INITIAL_RESPONSE_BODY_BUFFER 512</span><br><span style="color: hsl(0, 100%, 40%);">-#endif /* !defined(LOW_MEMORY) */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /*! Maximum line length for HTTP requests. */</span><br><span> #if !defined(LOW_MEMORY)</span><br><span> #define MAX_HTTP_LINE_LENGTH 4096</span><br><span>@@ -570,7 +563,7 @@</span><br><span> {</span><br><span> char server_name[MAX_SERVER_NAME_LENGTH];</span><br><span> struct ast_str *server_address = ast_str_create(MAX_SERVER_NAME_LENGTH);</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_str *out = ast_str_create(INITIAL_RESPONSE_BODY_BUFFER);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_str *out = ast_str_create(MAX_CONTENT_LENGTH);</span><br><span> </span><br><span> if (!http_header_data || !server_address || !out) {</span><br><span> ast_free(http_header_data);</span><br><span>@@ -929,30 +922,19 @@</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(0, 100%, 40%);">- int total = 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /* Stream is in exclusive mode so we get it all if possible. */</span><br><span style="color: hsl(0, 100%, 40%);">- while (total != length) {</span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span style="color: hsl(0, 100%, 40%);">- * NOTE: Because ser->f is a non-standard FILE *, fread() does not behave as</span><br><span style="color: hsl(0, 100%, 40%);">- * documented.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * NOTE: Because ser->f is a non-standard FILE *, fread() does not behave as</span><br><span style="color: hsl(120, 100%, 40%);">+ * documented.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /* Stay in fread until get all the expected data or timeout. */</span><br><span style="color: hsl(0, 100%, 40%);">- res = fread(buf + total, length - total, 1, ser->f);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res <= 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- total += res;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (total != length) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Wrong HTTP content read. Request %s (Wanted %d, Read %d)\n",</span><br><span style="color: hsl(0, 100%, 40%);">- what_getting, length, res);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Stay in fread until get all the expected data or timeout. */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = fread(buf, length, 1, ser->f);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (res < 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Short HTTP request %s (Wanted %d)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ what_getting, length);</span><br><span> return -1;</span><br><span> }</span><br><span style="color: hsl(0, 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/c/asterisk/+/11063">change 11063</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/c/asterisk/+/11063"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: Ica47ca2cac1b21c6ef907c1ffbfaf2cebdea8e80 </div>
<div style="display:none"> Gerrit-Change-Number: 11063 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Matthew Fredrickson <creslin@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: sungtae kim <pchero21@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>