Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nanoweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ async def handle(self, reader, writer):
break
else:
# 3. Try to load index file
await write(request, "HTTP/1.1 200 OK\r\n\r\n")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send_file can raise HttpError and in this case status 404 would be sent after status 200

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line 95-97:

            if isinstance(handler, str):
                await write(request, "HTTP/1.1 200 OK\r\n\r\n")
                await send_file(request, handler)

That might also cause this situation. Maybe this should also be changed?

if request.url in ('', '/'):
await send_file(request, self.INDEX_FILE)
else:
Expand Down