mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 23:02:25 +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
|
||||
|
||||
from autobahn.twisted.resource import WebSocketResource
|
||||
@ -28,11 +35,11 @@ class TokenAuthenticatedWebSocketServerProtocol(WebSocketServerProtocol):
|
||||
"""
|
||||
WebSocket callback
|
||||
"""
|
||||
if 'authorization' in req.headers:
|
||||
auth = req.headers['authorization'].encode('ascii').split(' ', 1)
|
||||
if b'authorization' in req.headers:
|
||||
auth = req.headers[b'authorization'].encode('ascii').split(b' ', 1)
|
||||
if len(auth) == 2:
|
||||
tag, token = auth
|
||||
if tag == "tahoe-lafs":
|
||||
if tag == b"tahoe-lafs":
|
||||
if timing_safe_compare(token, self.factory.tahoe_client.get_auth_token()):
|
||||
# we don't care what WebSocket sub-protocol is
|
||||
# negotiated, nor do we need to send headers to the
|
||||
|
Loading…
Reference in New Issue
Block a user