[asterisk-commits] mjordan: branch 12 r411687 - /branches/12/main/http.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Apr 4 10:11:58 CDT 2014
Author: mjordan
Date: Fri Apr 4 10:11:48 2014
New Revision: 411687
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411687
Log:
http: Fix spurious ERROR message in responses with no content
When a response has a content length of 0, fwrite would be called to write a
buffer with no data in it. This resulted in the following classic error
message:
[Apr 3 11:49:17] ERROR[26421] http.c: fwrite() failed: Success
This patch makes it so that we only attempt to write out the content if the
calculated content_length is non-zero.
Modified:
branches/12/main/http.c
Modified: branches/12/main/http.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/http.c?view=diff&rev=411687&r1=411686&r2=411687
==============================================================================
--- branches/12/main/http.c (original)
+++ branches/12/main/http.c Fri Apr 4 10:11:48 2014
@@ -416,7 +416,7 @@
/* calc content length */
if (out) {
- content_length += strlen(ast_str_buffer(out));
+ content_length += ast_str_strlen(out);
}
if (fd) {
@@ -443,7 +443,7 @@
/* send content */
if (method != AST_HTTP_HEAD || status_code >= 400) {
- if (out) {
+ if (content_length) {
if (fwrite(ast_str_buffer(out), content_length, 1, ser->f) != 1) {
ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
}
More information about the asterisk-commits
mailing list