mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-21 11:30:01 +00:00
Make ws_upgrade() respond with error if request is not and upgrade
This commit is contained in:
1 parent
a36050ab4b
commit
9b18a6350a
3 files changed
+43
-32
No files matched your search
@@ -217,13 +217,16 @@ void mg_ws_upgrade(struct mg_connection *c, struct mg_http_message *hm,
|
||||
const char *fmt, ...) {
|
||||
struct mg_str *wskey = mg_http_get_header(hm, "Sec-WebSocket-Key");
|
||||
c->pfn = mg_ws_cb;
|
||||
if (wskey != NULL) {
|
||||
if (wskey == NULL) {
|
||||
mg_http_reply(c, 426, "", "WS upgrade expected\n");
|
||||
c->is_draining = 1;
|
||||
} else {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
ws_handshake(c, wskey->ptr, wskey->len, fmt, ap);
|
||||
va_end(ap);
|
||||
c->is_websocket = 1;
|
||||
}
|
||||
c->is_websocket = 1;
|
||||
}
|
||||
|
||||
size_t mg_ws_wrap(struct mg_connection *c, size_t len, int op) {
|
||||
|
||||
Reference in new issue
Block a user