lib/httpx/connection/http1.rb in httpx-1.1.0 vs lib/httpx/connection/http1.rb in httpx-1.1.1
- old
+ new
@@ -179,11 +179,11 @@
@parser.reset!
@max_requests -= 1
if response.is_a?(ErrorResponse)
disable
else
- manage_connection(response)
+ manage_connection(request, response)
end
if exhausted?
@pending.concat(@requests)
@requests.clear
@@ -222,11 +222,11 @@
emit(:exhausted)
end
private
- def manage_connection(response)
+ def manage_connection(request, response)
connection = response.headers["connection"]
case connection
when /keep-alive/i
if @handshake_completed
if @max_requests.zero?
@@ -252,10 +252,10 @@
@handshake_completed = true
when /close/i
disable
when nil
# In HTTP/1.1, it's keep alive by default
- return if response.version == "1.1"
+ return if response.version == "1.1" && request.headers["connection"] != "close"
disable
end
end