Please let me know if there is a reason the HTTP 1.1 version remains in the code - despite possible need for it to be http 1.0. I am new to learning about HTTP and related topics :)
@coldenate The simple answer is that this is only the second time (to my knowledge) that someone has reported a server not supporting HTTP/1.0 (which is a surprising thing for a web server to do), whereas we have no idea how many people are using urequests with servers that only support HTTP/1.0 (odd, but reasonable).
Your suggestion to make it optional is probably reasonable. I would argue that perhaps we are de-facto using HTTP/1.1 anyway (setting Host: and Transfer-Encoding:), so possibly should just make the change rather than just making the code bigger. (And also, seriously, how many web servers are there out there that don't support HTTP/1.1 ???).
I'd be interested to see if anyone else has any comments.
Hey! I also think it is better to update the header in line 39 of
micropython-lib/micropython/urllib.urequest/urllib/urequest.pyas,As I know, most major web servers and CDNs provide backward compatibility. Therefore there will be no harm by updating it.
HTTP/2 is a binary protocol and uses HPACK for header compression. Changing this, require additional code to handle the protocol and header compression.
I also think the change to HTTP/1.1 may require some additional code, to handle the different connection types :
close,keep-alive.In addition, there are different Transfer-Endocings.
It would be good to merge back some of the changes from the CircuitPython requests library (they've updated it since originally starting with the MicroPython implementation). In it, they respond with v1.1, though I'm not sure it 100% conforms to spec...
https://github.com/adafruit/Adafruit_CircuitPython_Requests/blob/main/adafruit_requests.py