lib/httpx/connection/http1.rb in httpx-1.3.0 vs lib/httpx/connection/http1.rb in httpx-1.3.1
- old
+ new
@@ -195,11 +195,11 @@
else
send(@pending.shift) unless @pending.empty?
end
end
- def handle_error(ex)
+ def handle_error(ex, request = nil)
if (ex.is_a?(EOFError) || ex.is_a?(TimeoutError)) && @request && @request.response &&
!@request.response.headers.key?("content-length") &&
!@request.response.headers.key?("transfer-encoding")
# if the response does not contain a content-length header, the server closing the
# connnection is the indicator of response consumed.
@@ -209,14 +209,18 @@
end
if @pipelining
catch(:called) { disable }
else
- @requests.each do |request|
- emit(:error, request, ex)
+ @requests.each do |req|
+ next if request && request == req
+
+ emit(:error, req, ex)
end
- @pending.each do |request|
- emit(:error, request, ex)
+ @pending.each do |req|
+ next if request && request == req
+
+ emit(:error, req, ex)
end
end
end
def ping