SimpleChatTC:SimpleProxy: Start server, Show requested path

This commit is contained in:
hanishkvc 2025-10-16 18:06:56 +05:30
parent 05c0ade8be
commit 80fd065993
1 changed files with 20 additions and 0 deletions

View File

@ -6,10 +6,20 @@
# fetches the contents of the specified url and returns the same to the requester
#
import sys
import http.server
gMe = {}
class ProxyHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
print(self.path)
def process_args(args: list[str]):
global gMe
gMe['INTERNAL.ProcessArgs.Malformed'] = []
@ -33,5 +43,15 @@ def process_args(args: list[str]):
iArg += 1
def run():
gMe['server'] = http.server.HTTPServer(('',gMe['--port']), ProxyHandler)
try:
gMe['server'].serve_forever()
except KeyboardInterrupt:
print("INFO:Run:Shuting down...")
gMe['server'].server_close()
sys.exit(0)
if __name__ == "__main__":
process_args(sys.argv)
run()