lib/httpx/connection/http1.rb in httpx-0.14.3 vs lib/httpx/connection/http1.rb in httpx-0.14.4
- old
+ new
@@ -256,10 +256,12 @@
if !request.headers.key?("content-length") &&
request.body.bytesize == Float::INFINITY
request.chunk!
end
- connection = if request.options.persistent || request != @requests[-1]
+ requests_limit = [@max_requests, @requests.size].min
+
+ connection = if request.options.persistent || request != @requests[requests_limit - 1]
"keep-alive"
else
"close"
end