lib/httpx/connection/http1.rb in httpx-0.11.2 vs lib/httpx/connection/http1.rb in httpx-0.11.3
- old
+ new
@@ -159,9 +159,19 @@
send(@pending.shift) unless @pending.empty?
end
def handle_error(ex)
+ if ex.is_a?(EOFError) && @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.
+ # https://greenbytes.de/tech/webdav/rfc2616.html#rfc.section.4.4
+ on_complete
+ return
+ end
+
if @pipelining
disable
else
@requests.each do |request|
emit(:error, request, ex)