Fix non-websocket connection header parsing

This commit is contained in:
Andrew Godwin 2016-02-23 21:59:33 +00:00
parent cacce0493d
commit a683fecfa6

View File

@ -44,7 +44,7 @@ class WebRequest(http.Request):
if b"?" in self.uri: if b"?" in self.uri:
self.query_string = self.uri.split(b"?", 1)[1] self.query_string = self.uri.split(b"?", 1)[1]
# Is it WebSocket? IS IT?! # 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 # Make WebSocket protocol to hand off to
protocol = self.factory.ws_factory.buildProtocol(self.transport.getPeer()) protocol = self.factory.ws_factory.buildProtocol(self.transport.getPeer())
if not protocol: if not protocol: