This is an automated email from the ASF dual-hosted git repository.
dcelasun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new 7c4bdf9 THRIFT-5184: Fix header check for WebSocket connections
7c4bdf9 is described below
commit 7c4bdf9914fcba6c89e0f69ae48b9675578f084a
Author: penenin <[email protected]>
AuthorDate: Mon Apr 27 01:11:47 2020 -0700
THRIFT-5184: Fix header check for WebSocket connections
When establishing a WebSocket connection, Firefox sends Connection:
keep-alive, Upgrade instead of just Connection: Upgrade. Check to see if
Upgrade is in the header instead of checking to see if it is the entire header
value.
Client: d
---
lib/d/src/thrift/transport/websocket.d | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/d/src/thrift/transport/websocket.d
b/lib/d/src/thrift/transport/websocket.d
index 25d1f7d..b800e51 100644
--- a/lib/d/src/thrift/transport/websocket.d
+++ b/lib/d/src/thrift/transport/websocket.d
@@ -121,7 +121,7 @@ protected:
upgrade_ = sicmp(upgrade, "websocket") == 0;
} else if (startsWith!compToLower(split[0], cast(ubyte[])"connection")) {
auto connection = stripLeft(cast(const(char)[])split[2]);
- connection_ = sicmp(connection, "upgrade") == 0;
+ connection_ = canFind(connection.toLower, "upgrade");
} else if (startsWith!compToLower(split[0],
cast(ubyte[])"sec-websocket-key")) {
auto secWebSocketKey = stripLeft(cast(const(char)[])split[2]);
auto hash = sha1Of(secWebSocketKey ~ WEBSOCKET_GUID);