Fix global variables
This commit is contained in:
parent
0f2f44102e
commit
ed18a62a2d
|
@ -12,6 +12,7 @@ done = ''
|
|||
|
||||
class HTTPRequestHandler(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
global Q, done
|
||||
p = parse.parse_qs(parse.urlsplit(self.path).query)
|
||||
func = parse.urlsplit(self.path).path[1:]
|
||||
|
||||
|
@ -22,7 +23,6 @@ class HTTPRequestHandler(BaseHTTPRequestHandler):
|
|||
if func == "tunnel":
|
||||
if "pubkey" in p:
|
||||
Q = p["path"]
|
||||
global done
|
||||
while done == '':
|
||||
sleep(0.01)
|
||||
self.wfile.write(done.encode('utf-8'))
|
||||
|
@ -36,7 +36,6 @@ class HTTPRequestHandler(BaseHTTPRequestHandler):
|
|||
self.wfile.write(str(Fetch(user)).encode('utf-8'))
|
||||
|
||||
elif func == "queue":
|
||||
global Q
|
||||
while Q == '':
|
||||
sleep(0.01)
|
||||
self.wfile.write(Q.encode('utf-8'))
|
||||
|
@ -44,6 +43,7 @@ class HTTPRequestHandler(BaseHTTPRequestHandler):
|
|||
|
||||
|
||||
def do_POST(self):
|
||||
global done
|
||||
data = self.rfile.read(int(self.headers['Content-Length']))
|
||||
func = parse.urlsplit(self.path).path[1:]
|
||||
p = parse.parse_qs(parse.urlsplit(self.path).query)
|
||||
|
@ -81,7 +81,6 @@ class HTTPRequestHandler(BaseHTTPRequestHandler):
|
|||
petname_to_pubkey[user] = {}
|
||||
|
||||
elif func == 'done':
|
||||
global done
|
||||
done = data
|
||||
else:
|
||||
print('Not implemented')
|
||||
|
|
Loading…
Reference in a new issue