mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
moved on connection close to separate method, which will address all connection logic
This commit is contained in:
parent
6c890bfa12
commit
083dd5ae6d
@ -129,9 +129,7 @@ module HTTPX
|
||||
|
||||
reset
|
||||
send(@pending.shift) unless @pending.empty?
|
||||
return unless response.headers["connection"] == "close"
|
||||
disable_concurrency
|
||||
emit(:reset)
|
||||
manage_connection(response)
|
||||
end
|
||||
|
||||
def handle_error(ex)
|
||||
@ -142,6 +140,15 @@ module HTTPX
|
||||
|
||||
private
|
||||
|
||||
def manage_connection(response)
|
||||
connection = response.headers["connection"]
|
||||
case connection
|
||||
when /close/i, nil
|
||||
disable_pipelining
|
||||
emit(:reset)
|
||||
end
|
||||
end
|
||||
|
||||
def disable_concurrency
|
||||
return if @requests.empty?
|
||||
@requests.each { |r| r.transition(:idle) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user