Fix autoserving of directory indexes.
This commit is contained in:
parent
7e1b71cf78
commit
59c9dfcf6b
@ -60,11 +60,14 @@ class Server(http.server.SimpleHTTPRequestHandler):
|
|||||||
# send response headers
|
# send response headers
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
|
||||||
with open(self.path.strip('/'), 'rb') as f:
|
path = self.path
|
||||||
|
if os.path.isdir(path.strip('/')):
|
||||||
|
path = path.strip('/') + '/index.html'
|
||||||
|
with open(path.strip('/'), 'rb') as f:
|
||||||
# send the body of the response
|
# send the body of the response
|
||||||
self.wfile.write(f.read())
|
self.wfile.write(f.read())
|
||||||
|
|
||||||
if not self.path.endswith('.html'):
|
if not path.endswith('.html'):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
# Append update waiter
|
# Append update waiter
|
||||||
|
Loading…
Reference in New Issue
Block a user