From 05697afc1550e8d4488980c083fa99ab58bb989b Mon Sep 17 00:00:00 2001 From: hanishkvc Date: Fri, 5 Dec 2025 02:47:04 +0530 Subject: [PATCH] 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. --- tools/server/public_simplechat/docs/changelog.md | 4 ++++ .../public_simplechat/local.tools/simpleproxy.py | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/server/public_simplechat/docs/changelog.md b/tools/server/public_simplechat/docs/changelog.md index a3895a337e..7a1b7200d5 100644 --- a/tools/server/public_simplechat/docs/changelog.md +++ b/tools/server/public_simplechat/docs/changelog.md @@ -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 diff --git a/tools/server/public_simplechat/local.tools/simpleproxy.py b/tools/server/public_simplechat/local.tools/simpleproxy.py index 23a7ac7e1c..ca2ffaad28 100644 --- a/tools/server/public_simplechat/local.tools/simpleproxy.py +++ b/tools/server/public_simplechat/local.tools/simpleproxy.py @@ -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']):