From ebd1708251dec95ece3521aa06114e76245e5473 Mon Sep 17 00:00:00 2001 From: Pierre Jacobs Date: Sun, 14 Jan 2024 17:30:11 +0100 Subject: [PATCH] #692 Remove closing of the WebSocket if no subprotocol is matching --- include/crow/websocket.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/include/crow/websocket.h b/include/crow/websocket.h index 94e663cf6..222bed5b2 100644 --- a/include/crow/websocket.h +++ b/include/crow/websocket.h @@ -101,14 +101,7 @@ namespace crow { auto requested_subprotocols = utility::split(requested_subprotocols_header, ", "); auto subprotocol = utility::find_first_of(subprotocols.begin(), subprotocols.end(), requested_subprotocols.begin(), requested_subprotocols.end()); - if (subprotocol == subprotocols.end()) - { - adaptor_.close(); - handler_->remove_websocket(this); - delete this; - return; - } - else + if (subprotocol != subprotocols.end()) { subprotocol_ = *subprotocol; }