|
@@ -297,10 +297,12 @@ class StreamHandler(BaseHTTPRequestHandler):
|
297
|
297
|
class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
|
298
|
298
|
"""Handle requests in a separate thread."""
|
299
|
299
|
|
300
|
|
-def start(host = HOST_NAME, port = PORT_NUMBER, redirect=REDIRECT):
|
301
|
|
- global REDIRECT
|
|
300
|
+def start(host = HOST_NAME, port = PORT_NUMBER, key=KEY, redirect=REDIRECT):
|
|
301
|
+ global REDIRECT,KEY
|
302
|
302
|
if redirect:
|
303
|
303
|
REDIRECT = redirect
|
|
304
|
+ if key:
|
|
305
|
+ KEY = key
|
304
|
306
|
httpd = ThreadedHTTPServer((host, port), StreamHandler)
|
305
|
307
|
print time.asctime(), "Server Starts - %s:%s" % (HOST_NAME, PORT_NUMBER)
|
306
|
308
|
try:
|
|
@@ -310,10 +312,12 @@ def start(host = HOST_NAME, port = PORT_NUMBER, redirect=REDIRECT):
|
310
|
312
|
httpd.server_close()
|
311
|
313
|
print time.asctime(), "Server Stops - %s:%s" % (HOST_NAME, PORT_NUMBER)
|
312
|
314
|
|
313
|
|
-def start2(host = HOST_NAME, port = PORT_NUMBER, redirect=REDIRECT,workers=WORKERS):
|
314
|
|
- global REDIRECT
|
|
315
|
+def start2(host = HOST_NAME, port = PORT_NUMBER, redirect=REDIRECT, key=KEY, workers=WORKERS):
|
|
316
|
+ global REDIRECT,KEY
|
315
|
317
|
if redirect:
|
316
|
318
|
REDIRECT = redirect
|
|
319
|
+ if key:
|
|
320
|
+ KEY = key
|
317
|
321
|
|
318
|
322
|
print time.asctime(), "Server Starts - %s:%s" % (host, port)
|
319
|
323
|
addr = ('', port)
|