SimpleSallap:SimpleProxy:Trap all GET request handling

otherwise aum path was not handled immidiately wrt exceptions.

this also ensures any future changes wrt get request handling
also get handled immidiately wrt exceptions, that may be missed
by any targetted exception handling.
This commit is contained in:
hanishkvc 2025-12-05 02:47:04 +05:30
parent e52a7aa304
commit 05697afc15
2 changed files with 18 additions and 1 deletions

View File

@ -312,6 +312,10 @@ Chat Session specific settings
out. In turn if the tool call times out, one can send the timeout message as the response to the tool call
or what ever they see fit. Parallely, they can always look into the external ai specific special chat session
tab to see the ai response live stream and the progress wrt the tool call that timed out.
* SimpleProxy
* add ssl ie https support and restrict it to latest supported ssl/tls version
* enable multi threaded ssl and client request handling, so that rogue clients cant mount simple DoS
by opening connection and then missing in action.
## ToDo

View File

@ -132,7 +132,7 @@ class ProxyHandler(http.server.BaseHTTPRequestHandler):
except Exception as e:
self.send_error(400, f"ERRR:ProxyHandler:{e}")
def do_GET(self):
def _do_GET(self):
"""
Handle GET requests
"""
@ -155,6 +155,16 @@ class ProxyHandler(http.server.BaseHTTPRequestHandler):
print(f"WARN:ProxyHandler:GET:UnknownPath{pr.path}")
self.send_error(400, f"WARN:UnknownPath:{pr.path}")
def do_GET(self):
"""
Catch all / trap any exceptions wrt actual get based request handling.
"""
try:
self._do_GET()
except:
print(f"ERRR:PH:TheGET:{traceback.format_exception_only(sys.exception())}")
self.send_error(500, f"ERRR: handling request")
def do_OPTIONS(self):
"""
Handle OPTIONS for CORS preflights (just in case from browser)
@ -164,6 +174,9 @@ class ProxyHandler(http.server.BaseHTTPRequestHandler):
self.send_headers_common()
def handle(self) -> None:
"""
Helps handle ssl setup in the client specific thread, if in https mode
"""
print(f"\n\n\nDBUG:ProxyHandler:Handle:RequestFrom:{self.client_address}")
try:
if (gMe['sslContext']):