SimpleChatTC:SimpleProxy: Start server, Show requested path
This commit is contained in:
parent
05c0ade8be
commit
80fd065993
|
|
@ -6,10 +6,20 @@
|
||||||
# fetches the contents of the specified url and returns the same to the requester
|
# fetches the contents of the specified url and returns the same to the requester
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import http.server
|
||||||
|
|
||||||
|
|
||||||
gMe = {}
|
gMe = {}
|
||||||
|
|
||||||
|
|
||||||
|
class ProxyHandler(http.server.BaseHTTPRequestHandler):
|
||||||
|
def do_GET(self):
|
||||||
|
print(self.path)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def process_args(args: list[str]):
|
def process_args(args: list[str]):
|
||||||
global gMe
|
global gMe
|
||||||
gMe['INTERNAL.ProcessArgs.Malformed'] = []
|
gMe['INTERNAL.ProcessArgs.Malformed'] = []
|
||||||
|
|
@ -33,5 +43,15 @@ def process_args(args: list[str]):
|
||||||
iArg += 1
|
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__":
|
if __name__ == "__main__":
|
||||||
process_args(sys.argv)
|
process_args(sys.argv)
|
||||||
|
run()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue