Skip to content

Commit

Permalink
fix #343
Browse files Browse the repository at this point in the history
  • Loading branch information
samoconnor committed Nov 1, 2018
1 parent b6bd9c3 commit b7d1848
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ConnectionRequest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand All @@ -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
Expand Down

0 comments on commit b7d1848

Please sign in to comment.