miguelgrinberg/microdot

UTF-8 decode error

xuancong84 opened this issue · 5 comments

Very often, I encounter the following print stack while the HTTP server is still working fine:

#22 ets_task(4020f57c, 29, 3fffad20, 10)
('192.168.4.1', '255.255.255.0', '192.168.4.1', '192.168.4.1')
Traceback (most recent call last):
  File "microdot.py", line 1171, in handle_request
  File "microdot.py", line 384, in create
UnicodeError:

Do you know that bytes.decode() can fail?

The failure in that line would occur if the request URL is not encoded in UTF-8 characters. What is the URL the client is requesting in this case?

Hello,

I have the same thing
In my personnal case this URL:
https://192.168.1.76:80/

So i tested without the 's' of https and it is working

Regards

Correct, an https URL would not be a valid UTF-8 stream and would cause decode errors such as the one reported. I will close, assuming this is what happened to you, OP. If you need more assistance, please reopen.

Correct, an https URL would not be a valid UTF-8 stream and would cause decode errors such as the one reported. I will close, assuming this is what happened to you, OP. If you need more assistance, please reopen.

Hello, is there a special encoding for https url ? Thanks.

No. If you want to use https you have to configure the server for it. See the ssl option that you pass to therun() method.