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.
pull/502/head
Paul Sokolovsky 2018-08-10 07:41:54 +03:00 zatwierdzone przez Damien George
rodzic 5854ae1286
commit d978e246d5
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -81,7 +81,7 @@ def request(method, url, data=None, json=None, headers={}, stream=None, parse_he
s.write(b"Content-Type: application/json\r\n")
if data:
s.write(b"Content-Length: %d\r\n" % len(data))
s.write(b"\r\n")
s.write(b"Connection: close\r\n\r\n")
if data:
s.write(data)