summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-07-12 04:25:20 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-07-12 04:25:20 -0500
commit3bf42a58c421b3e8cca5f92e124c2194ef86ac85 (patch)
treed284382d59b96131353ab63038296e3181d5eee3 /main
parent4f2f3bfebfb3a49a0fe407aaba6608114f8bd0bf (diff)
parent32b98ad956045d9752f72f010af652294899e563 (diff)
Merge "http.c: Reduce log spam" into 13
Diffstat (limited to 'main')
-rw-r--r--main/http.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/main/http.c b/main/http.c
index cccc60b81..40f7b521f 100644
--- a/main/http.c
+++ b/main/http.c
@@ -505,7 +505,7 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
}
/* send http header */
- fprintf(ser->f,
+ if (fprintf(ser->f,
"HTTP/1.1 %d %s\r\n"
"%s"
"Date: %s\r\n"
@@ -521,17 +521,20 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
static_content ? "" : "Cache-Control: no-cache, no-store\r\n",
http_header ? ast_str_buffer(http_header) : "",
content_length
- );
+ ) <= 0) {
+ ast_debug(1, "fprintf() failed: %s\n", strerror(errno));
+ close_connection = 1;
+ }
/* send content */
- if (method != AST_HTTP_HEAD || status_code >= 400) {
+ if (!close_connection && (method != AST_HTTP_HEAD || status_code >= 400)) {
if (out && ast_str_strlen(out)) {
/*
* NOTE: Because ser->f is a non-standard FILE *, fwrite() will probably not
* behave exactly as documented.
*/
if (fwrite(ast_str_buffer(out), ast_str_strlen(out), 1, ser->f) != 1) {
- ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
+ ast_debug(1, "fwrite() failed: %s\n", strerror(errno));
close_connection = 1;
}
}
@@ -546,7 +549,7 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
* behave exactly as documented.
*/
if (fwrite(buf, len, 1, ser->f) != 1) {
- ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+ ast_debug(1, "fwrite() failed: %s\n", strerror(errno));
close_connection = 1;
break;
}