From a683fecfa6804ab48e81b9de8e5ddc247df28be9 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Tue, 23 Feb 2016 21:59:33 +0000 Subject: [PATCH] Fix non-websocket connection header parsing --- daphne/http_protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daphne/http_protocol.py b/daphne/http_protocol.py index 8f33afb..9986393 100755 --- a/daphne/http_protocol.py +++ b/daphne/http_protocol.py @@ -44,7 +44,7 @@ class WebRequest(http.Request): if b"?" in self.uri: self.query_string = self.uri.split(b"?", 1)[1] # Is it WebSocket? IS IT?! - if upgrade_header.lower() == b"websocket": + if upgrade_header and upgrade_header.lower() == b"websocket": # Make WebSocket protocol to hand off to protocol = self.factory.ws_factory.buildProtocol(self.transport.getPeer()) if not protocol: