Skip to content

Commit 5a88ec9

Browse files
committed
websocket: Discard streams not fully connected
1 parent b72c51f commit 5a88ec9

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/net/http/websocket.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,13 @@ WebSocket_ptr WebSocket::upgrade(Request& req, Response_writer& writer)
186186
writer.write_header(http::Switching_Protocols);
187187

188188
auto stream = writer.connection().release();
189-
assert(stream->is_connected());
190-
return std::make_unique<WebSocket>(std::move(stream), false);
189+
190+
// discard streams which can be FIN-WAIT-1
191+
if (stream->is_connected()) {
192+
// for now, only accept fully connected streams
193+
return std::make_unique<WebSocket>(std::move(stream), false);
194+
}
195+
return nullptr;
191196
}
192197

193198
WebSocket_ptr WebSocket::upgrade(Error err, Response& res, Connection& conn, const std::string& key)

0 commit comments

Comments
 (0)