Commit 64a1553c authored by Stijn's avatar Stijn

Fixed issue where connection fails in webkit-based browsers

parent 80538863
...@@ -134,7 +134,7 @@ class ServerHandshake(Handshake): ...@@ -134,7 +134,7 @@ class ServerHandshake(Handshake):
# Only a supported protocol can be returned # Only a supported protocol can be returned
client_proto = split_stripped(headers['Sec-WebSocket-Protocol']) \ client_proto = split_stripped(headers['Sec-WebSocket-Protocol']) \
if 'Sec-WebSocket-Protocol' in headers else [] if 'Sec-WebSocket-Protocol' in headers else []
protocol = 'null' protocol = None
for p in client_proto: for p in client_proto:
if p in self.wsock.proto: if p in self.wsock.proto:
...@@ -173,8 +173,12 @@ class ServerHandshake(Handshake): ...@@ -173,8 +173,12 @@ class ServerHandshake(Handshake):
yield 'WebSocket-Origin', origin yield 'WebSocket-Origin', origin
yield 'WebSocket-Location', location yield 'WebSocket-Location', location
yield 'Sec-WebSocket-Accept', accept yield 'Sec-WebSocket-Accept', accept
yield 'Sec-WebSocket-Protocol', protocol
yield 'Sec-WebSocket-Extensions', ', '.join(extensions) if protocol:
yield 'Sec-WebSocket-Protocol', protocol
if extensions:
yield 'Sec-WebSocket-Extensions', ', '.join(extensions)
class ClientHandshake(Handshake): class ClientHandshake(Handshake):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment