Closed adebaumann closed 6 years ago
Are such responses compliant to the HTTP standard?
According to RFC2616, "The client is not required to examine or display the Reason- Phrase" - see https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html.
From RFC 7230 (Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing):
The reason-phrase element exists for the sole purpose of providing a
textual description associated with the numeric status code, mostly
out of deference to earlier Internet application protocols that were
more frequently used with interactive text clients. A client SHOULD
ignore the reason-phrase content.
reason-phrase = *( HTAB / SP / VCHAR / obs-text )
I interpret the * as "optional".
Thanks for references. More discussion: https://stackoverflow.com/a/17517114/496009 . So, it's still not conclusive whether HTTP/1.0 200
is ok by the standard. What software does send out replies like that?
That's "Thingsboard" (https://thingsboard.io/)
I agree it's inconclusive - however, I think the fact that the reason-phrase is no longer used at all in HTTP/2 supports it's "optionalness" -- or should that be "optionality"...
Ok, thanks, let's consider it decided - I'll work on a fix for all 3 HTTP clients in micropython-lib.
Thanks!
Got caught in with other projects... First change is went in: https://github.com/pfalcon/micropython-lib/commit/4d46561a5bdebd1352dfa1454ba582831e1da179
Ok, all of urllib.urequest
, urequests
, uaiohttpclient
were updated.
I found that urequest produces an error when the http-response starts with "HTTP/1.1 500" instead of "HTTP/1.1 500 OK", complaining about needing more than 2 values to unpack. The standard python request module handles these cases fine.