in pysteve/standalone.py [0:0]
def do_GET(self):
try:
print(self.path)
if self.path.startswith("/steve/admin"):
if self.headers.getheader('Authorization') == None:
self.do_AUTHHEAD()
self.wfile.write('no auth header received')
return
else:
authed = False
auth = self.headers.getheader('Authorization')[6:]
arr = base64.decodestring(auth).split(":", 2)
if len(arr) == 2:
name = arr[0]
password= arr[1]
if karma.get(name) and karma[name] == password:
authed = True
if not authed:
self.do_AUTHHEAD()
self.wfile.write('Wrong user or pass received')
return
path_info = self.path.replace("/steve/admin", "", 1)
os.chdir(path + "/www/cgi-bin")
self.cgi_info = ("/", "rest_admin.py" + path_info)
self.run_cgi()
return
elif self.path.startswith("/steve/voter"):
path_info = self.path.replace("/steve/voter", "", 1)
os.chdir(path + "/www/cgi-bin")
self.cgi_info = ("/", "rest_voter.py" + path_info)
self.run_cgi()
return
else:
os.chdir(path)
self.path = "/www/htdocs" + self.path
print(self.path)
handler.do_GET(self)
except Exception as err:
doTraceBack()