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: