summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2019-08-15 05:05:38 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-08-15 06:05:38 +0200
commitb095203f28c60031a79b0c3ab39b50378ed77f67 (patch)
treeb850da978b5be945e95f84b0362d172199b782bb /lib
parent630e18a6eb249bfa69fd7f0c05f9370e2308ce94 (diff)
downloadNim-b095203f28c60031a79b0c3ab39b50378ed77f67.tar.gz
Fixes regression introduced by #11904. (#11948)
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/httpclient.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim
index daaf12597..5a98c5ede 100644
--- a/lib/pure/httpclient.nim
+++ b/lib/pure/httpclient.nim
@@ -342,7 +342,8 @@ proc parseBody(s: Socket, headers: HttpHeaders, httpVersion: string, timeout: in
       # (http://tools.ietf.org/html/rfc2616#section-4.4) NR.5
       let implicitConnectionClose =
         httpVersion == "1.0" or
-        httpVersion == "1.1" # This doesn't match the HTTP spec, but it fixes issues for non-conforming servers.
+        # This doesn't match the HTTP spec, but it fixes issues for non-conforming servers.
+        (httpVersion == "1.1" and headers.getOrDefault"Connection" == "")
       if headers.getOrDefault"Connection" == "close" or implicitConnectionClose:
         var buf = ""
         while true:
@@ -816,7 +817,8 @@ proc parseBody(client: HttpClient | AsyncHttpClient,
       # (http://tools.ietf.org/html/rfc2616#section-4.4) NR.5
       let implicitConnectionClose =
         httpVersion == "1.0" or
-        httpVersion == "1.1" # This doesn't match the HTTP spec, but it fixes issues for non-conforming servers.
+        # This doesn't match the HTTP spec, but it fixes issues for non-conforming servers.
+        (httpVersion == "1.1" and headers.getOrDefault"Connection" == "")
       if headers.getOrDefault"Connection" == "close" or implicitConnectionClose:
         while true:
           let recvLen = await client.recvFull(4000, client.timeout, true)