Skip to content

Commit d978e24

Browse files
pfalcondpgeorge
authored andcommitted
urequests: Explicitly add "Connection: close" to request headers.
Even though we use HTTP 1.0, where closing connection after sending response should be the default, some servers ignore this requirement and keep the connection open. So, explicitly send corresponding header to get the expected behavior.
1 parent 5854ae1 commit d978e24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python-ecosys/urequests/urequests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def request(method, url, data=None, json=None, headers={}, stream=None, parse_he
8181
s.write(b"Content-Type: application/json\r\n")
8282
if data:
8383
s.write(b"Content-Length: %d\r\n" % len(data))
84-
s.write(b"\r\n")
84+
s.write(b"Connection: close\r\n\r\n")
8585
if data:
8686
s.write(data)
8787

0 commit comments

Comments
 (0)