<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/5962">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">http.c: Reduce log spam<br><br>Messages like "fwrite() failed: Connection reset by peer" are no<br>help whatsoever, especially since they can be caused simply by a<br>client disconnecting.<br><br>* Make those WARNINGs DEBUGs.<br>* Check the return of the headers fprintf.<br><br>Change-Id: I17bd5f3621514152a7b2b263c801324c5e96568b<br>---<br>M main/http.c<br>1 file changed, 8 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/http.c b/main/http.c<br>index cccc60b..40f7b52 100644<br>--- a/main/http.c<br>+++ b/main/http.c<br>@@ -505,7 +505,7 @@<br> }<br> <br> /* send http header */<br>- fprintf(ser->f,<br>+ if (fprintf(ser->f,<br> "HTTP/1.1 %d %s\r\n"<br> "%s"<br> "Date: %s\r\n"<br>@@ -521,17 +521,20 @@<br> static_content ? "" : "Cache-Control: no-cache, no-store\r\n",<br> http_header ? ast_str_buffer(http_header) : "",<br> content_length<br>- );<br>+ ) <= 0) {<br>+ ast_debug(1, "fprintf() failed: %s\n", strerror(errno));<br>+ close_connection = 1;<br>+ }<br> <br> /* send content */<br>- if (method != AST_HTTP_HEAD || status_code >= 400) {<br>+ if (!close_connection && (method != AST_HTTP_HEAD || status_code >= 400)) {<br> if (out && ast_str_strlen(out)) {<br> /*<br> * NOTE: Because ser->f is a non-standard FILE *, fwrite() will probably not<br> * behave exactly as documented.<br> */<br> if (fwrite(ast_str_buffer(out), ast_str_strlen(out), 1, ser->f) != 1) {<br>- ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));<br>+ ast_debug(1, "fwrite() failed: %s\n", strerror(errno));<br> close_connection = 1;<br> }<br> }<br>@@ -546,7 +549,7 @@<br> * behave exactly as documented.<br> */<br> if (fwrite(buf, len, 1, ser->f) != 1) {<br>- ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));<br>+ ast_debug(1, "fwrite() failed: %s\n", strerror(errno));<br> close_connection = 1;<br> break;<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5962">change 5962</a>. To unsubscribe, 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/5962"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I17bd5f3621514152a7b2b263c801324c5e96568b </div>
<div style="display:none"> Gerrit-Change-Number: 5962 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>