From b7d184886d9c5cdc3ff674b1e0cfbb915623413a Mon Sep 17 00:00:00 2001 From: Sam O'Connor Date: Thu, 1 Nov 2018 15:43:55 +1100 Subject: [PATCH] fix #343 --- src/ConnectionRequest.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ConnectionRequest.jl b/src/ConnectionRequest.jl index 92e6a72f2..2ed45acf4 100644 --- a/src/ConnectionRequest.jl +++ b/src/ConnectionRequest.jl @@ -44,6 +44,10 @@ function request(::Type{ConnectionPoolLayer{Next}}, url::URI, req, body; rethrow(isioerror(e) ? IOError(e, "during request($url)") : e) end + if io.readcount >= reuse_limit + setheader(req, "Connection" => "close") + end + try if proxy !== nothing && target_url.scheme == "https" return tunnel_request(Next, io, target_url, req, body; kw...) @@ -56,7 +60,7 @@ function request(::Type{ConnectionPoolLayer{Next}}, url::URI, req, body; close(io) rethrow(isioerror(e) ? IOError(e, "during request($url)") : e) finally - if (reuse_limit == 0 + if (io.readcount > reuse_limit || (proxy !== nothing && target_url.scheme == "https")) close(io) end