File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed
Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -122,20 +122,15 @@ def do_heartbeat() -> None:
122122 exit (1 )
123123
124124 def fetch_session (self ) -> Tuple [Session , bool ]:
125- # Find the session cookie (if any)
126- cookie_hdr = ""
127- try :
128- cookie_hdr = self ._str_headers ["cookie" ]
129- except KeyError :
130- pass
131- cookie = SimpleCookie (cookie_hdr ) # type: ignore
132-
133- # Extract the session ID
125+ # Find the session cookie (if any) and extract the ID
134126 sid = None # type: Optional[str]
135- try :
136- sid = cookie ["session" ].value
137- except KeyError :
138- pass
127+ if "cookie" in self ._str_headers :
128+ cookie = SimpleCookie (self ._str_headers ["cookie" ]) # type: ignore
129+ if "session" in cookie :
130+ sid = cookie ["session" ].value
131+ if sid == "" :
132+ nlog ().log ("Empty session ID, reassigning..." )
133+ sid = None
139134
140135 # Fetch (or create) the session
141136 session = Session .get_session (self .client_address [0 ], sid )
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ def __contains__(self, key: Any) -> bool:
7070 Whether the key is present.
7171 """
7272 assert isinstance (key , str ), "key is no string"
73- return key in self ._backing
73+ return key . lower () in self ._backing
7474
7575 def __delitem__ (self , key : str ) -> None :
7676 """Deletes an item.
You can’t perform that action at this time.
0 commit comments