lib/httpx/connection.rb in httpx-0.4.0 vs lib/httpx/connection.rb in httpx-0.4.1
- old
+ new
@@ -175,12 +175,12 @@
transition(:closed)
emit(:close)
end
def send(request)
- if @error_response
- emit(:response, request, @error_response)
+ if @error
+ emit(:response, request, ErrorResponse.new(request, @error, @options))
elsif @parser && !@write_buffer.full?
request.headers["alt-used"] = @origin.authority if match_altsvcs?(request.uri)
parser.send(request)
else
@pending << request
@@ -295,20 +295,20 @@
parser.on(:error) do |request, ex|
case ex
when MisdirectedRequestError
emit(:uncoalesce, request.uri)
else
- response = ErrorResponse.new(ex, @options)
+ response = ErrorResponse.new(request, ex, @options)
request.emit(:response, response)
end
end
end
def transition(nextstate)
case nextstate
when :idle
- @error_response = nil
+ @error = nil
@timeout_threshold = @options.timeout.connect_timeout
@timeout = @timeout_threshold
when :open
return if @state == :closed
@@ -361,12 +361,12 @@
e = e.to_connection_error if connecting?
end
parser.handle_error(e) if @parser && parser.respond_to?(:handle_error)
- @error_response = ErrorResponse.new(e, @options)
+ @error = e
@pending.each do |request, _|
- request.emit(:response, @error_response)
+ request.emit(:response, ErrorResponse.new(request, @error, @options))
end
end
end
end