(20250102) SocketIO Tick-Out test
This commit is contained in:
@@ -403,12 +403,14 @@ async def on_connect(sid, environ, *args) -> bool:
|
||||
return False
|
||||
|
||||
# Check the origin of the incoming request:
|
||||
printer("Checking origin.")
|
||||
origin = environ.get("HTTP_ORIGIN", "???")
|
||||
if not origin_is_allowed(origin):
|
||||
printer("SOCKET REJECTED: Bad origin.", sid, origin)
|
||||
return False
|
||||
|
||||
# Get the session token from the incoming request:
|
||||
printer("Checking session token.")
|
||||
session_token = environ.get("HTTP_X_SESSION_TOKEN")
|
||||
if not session_token and len(args) > 0: session_token = args[0].get("X-Session-Token")
|
||||
if not session_token:
|
||||
@@ -416,6 +418,7 @@ async def on_connect(sid, environ, *args) -> bool:
|
||||
return False
|
||||
|
||||
# Get the user's details from the session token:
|
||||
printer("Fetching user info.")
|
||||
user_info = await redis_cache.get(key = session_token)
|
||||
if not user_info:
|
||||
printer("SOCKET REJECTED: Invalid session token.", sid)
|
||||
|
||||
Reference in New Issue
Block a user