From d978e246d5ea1c46f97d1e00e1abac6b0b9dcf3b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 10 Aug 2018 07:41:54 +0300 Subject: [PATCH] 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. --- python-ecosys/urequests/urequests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-ecosys/urequests/urequests.py b/python-ecosys/urequests/urequests.py index 1dc379bc..4aa2935c 100644 --- a/python-ecosys/urequests/urequests.py +++ b/python-ecosys/urequests/urequests.py @@ -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)