lib/httpx/connection.rb in httpx-1.2.6 vs lib/httpx/connection.rb in httpx-1.3.0
- old
+ new
@@ -46,10 +46,12 @@
attr_writer :timers
attr_accessor :family
def initialize(uri, options)
+ @origins = [uri.origin]
+ @origin = Utils.to_uri(uri.origin)
@options = Options.new(options)
@type = initialize_type(uri, @options)
@origins = [uri.origin]
@origin = Utils.to_uri(uri.origin)
@window_size = @options.window_size
@@ -335,11 +337,11 @@
# this tight loop reads all the data it can from the socket and pipes it to
# its parser.
#
loop do
siz = @io.read(@window_size, @read_buffer)
- log(level: 3, color: :cyan) { "IO READ: #{siz} bytes..." }
+ log(level: 3, color: :cyan) { "IO READ: #{siz} bytes... (wsize: #{@window_size}, rbuffer: #{@read_buffer.bytesize})" }
unless siz
ex = EOFError.new("descriptor closed")
ex.set_backtrace(caller)
on_error(ex)
return
@@ -502,11 +504,11 @@
parser.on(:error) do |request, ex|
case ex
when MisdirectedRequestError
emit(:misdirected, request)
else
- response = ErrorResponse.new(request, ex, @options)
+ response = ErrorResponse.new(request, ex)
request.response = response
request.emit(:response, response)
end
end
end
@@ -528,11 +530,11 @@
error = ConnectionError.new(e.message)
error.set_backtrace(e.backtrace)
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, error) : handle_error(error)
@state = :closed
emit(:close)
- rescue TLSError, HTTP2Next::Error::ProtocolError, HTTP2Next::Error::HandshakeError => e
+ rescue TLSError, ::HTTP2::Error::ProtocolError, ::HTTP2::Error::HandshakeError => e
# connect errors, exit gracefully
handle_error(e)
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, e) : handle_error(e)
@state = :closed
emit(:close)
@@ -655,10 +657,10 @@
end
def handle_error(error)
parser.handle_error(error) if @parser && parser.respond_to?(:handle_error)
while (request = @pending.shift)
- response = ErrorResponse.new(request, error, request.options)
+ response = ErrorResponse.new(request, error)
request.response = response
request.emit(:response, response)
end
end