http.c: Fix http header send content.
authorBen Ford <bford@digium.com>
Wed, 25 Oct 2017 14:23:55 +0000 (09:23 -0500)
committerBenjamin Keith Ford <bford@digium.com>
Wed, 25 Oct 2017 15:36:21 +0000 (10:36 -0500)
Currently ast_http_send barricades a portion of the content that
needs to be sent in order to establish a connection for things
like the ARI client. The conditional and contents have been changed
to ensure that everything that needs to be sent, will be sent.

ASTERISK-27372

Change-Id: I8816d2d8f80f4fefc6dcae4b5fdfc97f1e46496d

main/http.c

index 7191eb5..30b2fe2 100644 (file)
@@ -529,10 +529,8 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
                ) <= 0) {
                ast_debug(1, "ast_iostream_printf() failed: %s\n", strerror(errno));
                close_connection = 1;
-       }
-
-       /* send content */
-       if (!close_connection && send_content && fd) {
+       } else if (send_content && fd) {
+               /* send file content */
                while ((len = read(fd, buf, sizeof(buf))) > 0) {
                        if (ast_iostream_write(ser->stream, buf, len) != len) {
                                ast_debug(1, "ast_iostream_write() failed: %s\n", strerror(errno));