diff options
author | Joshua Colp <jcolp@digium.com> | 2015-07-07 17:01:24 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-07-07 17:01:24 -0500 |
commit | 6d4227bbba9f2a5a3e858d44a4d5f05e85714619 (patch) | |
tree | 80447bd0abe818f5ed7c04d6b9a1136d78deb8e3 | |
parent | 05e8e1498207055374312f43fb80fcf0b9d5ab45 (diff) | |
parent | 55137c3d123626e3a4621bd325b36b62e634abc5 (diff) |
Merge "res/res_http_websocket: Don't send HTTP response fragmented." into 13
-rw-r--r-- | res/res_http_websocket.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c index 9e8b680a9..1f1f77ce5 100644 --- a/res/res_http_websocket.c +++ b/res/res_http_websocket.c @@ -781,13 +781,6 @@ int AST_OPTIONAL_API_NAME(ast_websocket_uri_cb)(struct ast_tcptls_session_instan return 0; } - fprintf(ser->f, "HTTP/1.1 101 Switching Protocols\r\n" - "Upgrade: %s\r\n" - "Connection: Upgrade\r\n" - "Sec-WebSocket-Accept: %s\r\n", - upgrade, - websocket_combine_key(key, base64, sizeof(base64))); - /* RFC 6455, Section 4.1: * * 6. If the response includes a |Sec-WebSocket-Protocol| header @@ -798,11 +791,23 @@ int AST_OPTIONAL_API_NAME(ast_websocket_uri_cb)(struct ast_tcptls_session_instan * Connection_. */ if (protocol) { - fprintf(ser->f, "Sec-WebSocket-Protocol: %s\r\n", + fprintf(ser->f, "HTTP/1.1 101 Switching Protocols\r\n" + "Upgrade: %s\r\n" + "Connection: Upgrade\r\n" + "Sec-WebSocket-Accept: %s\r\n" + "Sec-WebSocket-Protocol: %s\r\n\r\n", + upgrade, + websocket_combine_key(key, base64, sizeof(base64)), protocol); + } else { + fprintf(ser->f, "HTTP/1.1 101 Switching Protocols\r\n" + "Upgrade: %s\r\n" + "Connection: Upgrade\r\n" + "Sec-WebSocket-Accept: %s\r\n\r\n", + upgrade, + websocket_combine_key(key, base64, sizeof(base64))); } - fprintf(ser->f, "\r\n"); fflush(ser->f); } else { |