This repository was archived by the owner on May 16, 2019. It is now read-only.
File tree 3 files changed +6
-2
lines changed
3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class OpenBazaarAPI(APIResource):
44
44
def authenticated (func ):
45
45
def _authenticate (self , request ):
46
46
session = request .getSession ()
47
- if session not in self .authenticated_sessions :
47
+ if session not in self .authenticated_sessions and "localhost" not in self . authenticated_sessions :
48
48
session .expire ()
49
49
request .setResponseCode (401 )
50
50
request .write ('<html><body><div><span style="color:red">Authorization Error</span></div>'
Original file line number Diff line number Diff line change @@ -367,7 +367,9 @@ class AuthenticatedWebSocketProtocol(WebSocketProtocol):
367
367
def validateHeaders (self ):
368
368
if "Cookie" in self .headers :
369
369
for session in self .factory .authenticated_sessions :
370
- if "TWISTED_SESSION=" + session .uid in self .headers ["Cookie" ]:
370
+ if session == "localhost" :
371
+ return WebSocketProtocol .validateHeaders (self )
372
+ elif "TWISTED_SESSION=" + session .uid in self .headers ["Cookie" ]:
371
373
return WebSocketProtocol .validateHeaders (self )
372
374
return False
373
375
Original file line number Diff line number Diff line change @@ -124,6 +124,8 @@ def on_bootstrap_complete(resp):
124
124
125
125
# websockets api
126
126
authenticated_sessions = []
127
+ if interface == "127.0.0.1" :
128
+ authenticated_sessions .append ("localhost" )
127
129
ws_api = WSFactory (mserver , kserver , only_ip = ALLOWIP )
128
130
ws_factory = AuthenticatedWebSocketFactory (ws_api )
129
131
ws_factory .authenticated_sessions = authenticated_sessions
You can’t perform that action at this time.
0 commit comments