task.cancel()
-async def process_request(sever_root, path, request_headers):
+async def process_request(server_root, path, request_headers):
if 'Upgrade' in request_headers:
return
if path == '/':
('Connection', 'close'),
]
server_root = os.path.realpath(os.path.join(os.getcwd(), server_root))
- full_path = os.path.realpath(os.path.join(sever_root, path[1:]))
- if os.path.commonpath((sever_root, full_path)) != sever_root or \
+ full_path = os.path.realpath(os.path.join(server_root, path[1:]))
+ if os.path.commonpath((server_root, full_path)) != server_root or \
not os.path.exists(full_path) or not os.path.isfile(full_path):
return HTTPStatus.NOT_FOUND, [], b'404 NOT FOUND'
mime_type = 'application/octet-stream'