mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merge "res/res_http_websocket: Don't send HTTP response fragmented." into 13
This commit is contained in:
@@ -781,13 +781,6 @@ int AST_OPTIONAL_API_NAME(ast_websocket_uri_cb)(struct ast_tcptls_session_instan
|
|||||||
return 0;
|
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:
|
/* RFC 6455, Section 4.1:
|
||||||
*
|
*
|
||||||
* 6. If the response includes a |Sec-WebSocket-Protocol| header
|
* 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_.
|
* Connection_.
|
||||||
*/
|
*/
|
||||||
if (protocol) {
|
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);
|
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);
|
fflush(ser->f);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user