Skip to content

Commit 05697af

Browse files
committed
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.
1 parent e52a7aa commit 05697af

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

tools/server/public_simplechat/docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,10 @@ Chat Session specific settings
312312
out. In turn if the tool call times out, one can send the timeout message as the response to the tool call
313313
or what ever they see fit. Parallely, they can always look into the external ai specific special chat session
314314
tab to see the ai response live stream and the progress wrt the tool call that timed out.
315+
* SimpleProxy
316+
* add ssl ie https support and restrict it to latest supported ssl/tls version
317+
* enable multi threaded ssl and client request handling, so that rogue clients cant mount simple DoS
318+
by opening connection and then missing in action.
315319

316320

317321
## ToDo

tools/server/public_simplechat/local.tools/simpleproxy.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def auth_and_run(self, pr:urllib.parse.ParseResult, handler:Callable[['ProxyHand
132132
except Exception as e:
133133
self.send_error(400, f"ERRR:ProxyHandler:{e}")
134134

135-
def do_GET(self):
135+
def _do_GET(self):
136136
"""
137137
Handle GET requests
138138
"""
@@ -155,6 +155,16 @@ def do_GET(self):
155155
print(f"WARN:ProxyHandler:GET:UnknownPath{pr.path}")
156156
self.send_error(400, f"WARN:UnknownPath:{pr.path}")
157157

158+
def do_GET(self):
159+
"""
160+
Catch all / trap any exceptions wrt actual get based request handling.
161+
"""
162+
try:
163+
self._do_GET()
164+
except:
165+
print(f"ERRR:PH:TheGET:{traceback.format_exception_only(sys.exception())}")
166+
self.send_error(500, f"ERRR: handling request")
167+
158168
def do_OPTIONS(self):
159169
"""
160170
Handle OPTIONS for CORS preflights (just in case from browser)
@@ -164,6 +174,9 @@ def do_OPTIONS(self):
164174
self.send_headers_common()
165175

166176
def handle(self) -> None:
177+
"""
178+
Helps handle ssl setup in the client specific thread, if in https mode
179+
"""
167180
print(f"\n\n\nDBUG:ProxyHandler:Handle:RequestFrom:{self.client_address}")
168181
try:
169182
if (gMe['sslContext']):

0 commit comments

Comments
 (0)