mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-25 21:59:19 +00:00
futurize
This commit is contained in:
parent
5f4f8d9dbb
commit
d00c4212a8
@ -1,3 +1,10 @@
|
|||||||
|
from __future__ import (
|
||||||
|
print_function,
|
||||||
|
unicode_literals,
|
||||||
|
absolute_import,
|
||||||
|
division,
|
||||||
|
)
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from autobahn.twisted.resource import WebSocketResource
|
from autobahn.twisted.resource import WebSocketResource
|
||||||
@ -28,11 +35,11 @@ class TokenAuthenticatedWebSocketServerProtocol(WebSocketServerProtocol):
|
|||||||
"""
|
"""
|
||||||
WebSocket callback
|
WebSocket callback
|
||||||
"""
|
"""
|
||||||
if 'authorization' in req.headers:
|
if b'authorization' in req.headers:
|
||||||
auth = req.headers['authorization'].encode('ascii').split(' ', 1)
|
auth = req.headers[b'authorization'].encode('ascii').split(b' ', 1)
|
||||||
if len(auth) == 2:
|
if len(auth) == 2:
|
||||||
tag, token = auth
|
tag, token = auth
|
||||||
if tag == "tahoe-lafs":
|
if tag == b"tahoe-lafs":
|
||||||
if timing_safe_compare(token, self.factory.tahoe_client.get_auth_token()):
|
if timing_safe_compare(token, self.factory.tahoe_client.get_auth_token()):
|
||||||
# we don't care what WebSocket sub-protocol is
|
# we don't care what WebSocket sub-protocol is
|
||||||
# negotiated, nor do we need to send headers to the
|
# negotiated, nor do we need to send headers to the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user