From 3c56e74d076bf319df240ed4052139cb3fdd55dd Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 5 Jun 2019 17:40:49 +0100 Subject: [PATCH] Httpd: Avoid console spam by WS ping/pong frames --- src/Network/http/httpd.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Network/http/httpd.cxx b/src/Network/http/httpd.cxx index 056c32fe4..f929e2a6f 100644 --- a/src/Network/http/httpd.cxx +++ b/src/Network/http/httpd.cxx @@ -426,8 +426,13 @@ int WebsocketConnection::onConnect(struct mg_connection * connection) int WebsocketConnection::request(struct mg_connection * connection) { setConnection(connection); + if ((connection->wsbits & 0x0f) >= 0x8) { + // control opcode (close/ping/pong) + return MG_MORE; + } + MongooseHTTPRequest request(connection); - SG_LOG(SG_NETWORK, SG_INFO, "WebsocketConnection::request for " << request.Uri); + SG_LOG(SG_NETWORK, SG_DEBUG, "WebsocketConnection::request for " << request.Uri); if ( NULL == _websocket) { SG_LOG(SG_NETWORK, SG_ALERT, "httpd: unhandled websocket uri: " << request.Uri);