2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 17:43:14 +00:00

Report on bad session ids

If an authorized user tries to use a session id that isn't recognized
(for example, a laptop coming out of suspend), cleanly return error
rather than traceback.
This commit is contained in:
Jarrod Johnson 2014-01-29 09:12:06 -05:00
parent 1b6c258934
commit 0e84935876

View File

@ -217,12 +217,18 @@ def resourcehandler(env, start_response):
for idx in xrange(0, len(querydict['keys']), 2):
input += chr(int(querydict['keys'][idx:idx+2],16))
sessid = querydict['session']
if sessid not in consolesessions:
start_response('400 Expired Session', headers)
return
consolesessions[sessid]['expiry'] = time.time() + 90
consolesessions[sessid]['session'].write(input)
start_response('200 OK', headers)
return # client has requests to send or receive, not both...
else: #no keys, but a session, means it's hooking to receive data
sessid = querydict['session']
if sessid not in consolesessions:
start_response('400 Expired Session', headers)
return
consolesessions[sessid]['expiry'] = time.time() + 90
outdata = consolesessions[sessid]['session'].get_next_output(timeout=45)
try: