This repository was archived by the owner on May 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed
Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class OpenBazaarAPI(APIResource):
4444 def authenticated (func ):
4545 def _authenticate (self , request ):
4646 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 :
4848 session .expire ()
4949 request .setResponseCode (401 )
5050 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):
367367 def validateHeaders (self ):
368368 if "Cookie" in self .headers :
369369 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" ]:
371373 return WebSocketProtocol .validateHeaders (self )
372374 return False
373375
Original file line number Diff line number Diff line change @@ -124,6 +124,8 @@ def on_bootstrap_complete(resp):
124124
125125 # websockets api
126126 authenticated_sessions = []
127+ if interface == "127.0.0.1" :
128+ authenticated_sessions .append ("localhost" )
127129 ws_api = WSFactory (mserver , kserver , only_ip = ALLOWIP )
128130 ws_factory = AuthenticatedWebSocketFactory (ws_api )
129131 ws_factory .authenticated_sessions = authenticated_sessions
You can’t perform that action at this time.
0 commit comments