Don't traceback if webclient don't pass the browser session with the wsurl, to make it easier on custom client implementations.
This commit is contained in:
parent
7870d21b00
commit
fd5ed02d7a
1 changed files with 13 additions and 7 deletions
|
|
@ -62,13 +62,19 @@ class WebSocketClient(Protocol, Session):
|
|||
|
||||
"""
|
||||
|
||||
self.csessid = self.transport.location.split("?", 1)[1]
|
||||
csession = _CLIENT_SESSIONS(session_key=self.csessid)
|
||||
uid = csession and csession.get("logged_in", False)
|
||||
if uid:
|
||||
# the client session is already logged in.
|
||||
self.uid = uid
|
||||
self.logged_in = True
|
||||
try:
|
||||
self.csessid = self.transport.location.split("?", 1)[1]
|
||||
except IndexError:
|
||||
# this may happen for custom webclients not caring for the
|
||||
# browser session.
|
||||
self.csessid = None
|
||||
if self.csessid:
|
||||
csession = _CLIENT_SESSIONS(session_key=self.csessid)
|
||||
uid = csession and csession.get("logged_in", False)
|
||||
if uid:
|
||||
# the client session is already logged in.
|
||||
self.uid = uid
|
||||
self.logged_in = True
|
||||
|
||||
# watch for dead links
|
||||
self.transport.setTcpKeepAlive(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue