lib/httpx/connection.rb in httpx-1.1.1 vs lib/httpx/connection.rb in httpx-1.1.2

- old
+ new

@@ -88,11 +88,11 @@ def addresses @io && @io.addresses end def match?(uri, options) - return false if @state == :closing || @state == :closed + return false if !used? && (@state == :closing || @state == :closed) return false if exhausted? ( ( @@ -501,13 +501,15 @@ end parser.on(:origin) do |origin| @origins |= [origin] end parser.on(:close) do |force| - transition(:closing) - if force || @state == :idle - transition(:closed) - emit(:close) + if @state != :closed + transition(:closing) + if force || @state == :idle + transition(:closed) + emit(:close) + end end end parser.on(:close_handshake) do consume end