diff options
author | Jenkins2 <jenkins2@gerrit.asterisk.org> | 2017-07-11 19:42:10 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-07-11 19:42:10 -0500 |
commit | fbcfa6b4b24834e155585ab2d2255da33e762f2c (patch) | |
tree | b4e0fe314036eede989472a2fa2f67a949ec1500 /main | |
parent | 3e7cfe3a92e87dd5c402f4476cee934e44236cc6 (diff) | |
parent | 303f935a50835ce40c3589603d8c66fff292c64a (diff) |
Merge "http.c: Reduce log spam"
Diffstat (limited to 'main')
-rw-r--r-- | main/http.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/main/http.c b/main/http.c index ea85a2823..7191eb524 100644 --- a/main/http.c +++ b/main/http.c @@ -508,7 +508,7 @@ void ast_http_send(struct ast_tcptls_session_instance *ser, send_content = method != AST_HTTP_HEAD || status_code >= 400; /* send http header */ - ast_iostream_printf(ser->stream, + if (ast_iostream_printf(ser->stream, "HTTP/1.1 %d %s\r\n" "%s" "Date: %s\r\n" @@ -526,13 +526,16 @@ void ast_http_send(struct ast_tcptls_session_instance *ser, http_header ? ast_str_buffer(http_header) : "", content_length, send_content && out && ast_str_strlen(out) ? ast_str_buffer(out) : "" - ); + ) <= 0) { + ast_debug(1, "ast_iostream_printf() failed: %s\n", strerror(errno)); + close_connection = 1; + } /* send content */ - if (send_content && fd) { + if (!close_connection && send_content && fd) { while ((len = read(fd, buf, sizeof(buf))) > 0) { if (ast_iostream_write(ser->stream, buf, len) != len) { - ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno)); + ast_debug(1, "ast_iostream_write() failed: %s\n", strerror(errno)); close_connection = 1; break; } |