lib/httpx/connection/http2.rb in httpx-1.2.6 vs lib/httpx/connection/http2.rb in httpx-1.3.0

- old
+ new

@@ -1,16 +1,16 @@ # frozen_string_literal: true require "securerandom" -require "http/2/next" +require "http/2" module HTTPX class Connection::HTTP2 include Callbacks include Loggable - MAX_CONCURRENT_REQUESTS = HTTP2Next::DEFAULT_MAX_CONCURRENT_STREAMS + MAX_CONCURRENT_REQUESTS = ::HTTP2::DEFAULT_MAX_CONCURRENT_STREAMS class Error < Error def initialize(id, code) super("stream #{id} closed with error: #{code}") end @@ -23,11 +23,11 @@ end attr_reader :streams, :pending def initialize(buffer, options) - @options = Options.new(options) + @options = options @settings = @options.http2_settings @pending = [] @streams = {} @drains = {} @pings = [] @@ -109,11 +109,11 @@ @streams[request] = stream @max_requests -= 1 end handle(request, stream) true - rescue HTTP2Next::Error::StreamLimitExceeded + rescue ::HTTP2::Error::StreamLimitExceeded @pending.unshift(request) end def consume @streams.each do |request, stream| @@ -166,11 +166,11 @@ request.transition(:done) end end def init_connection - @connection = HTTP2Next::Client.new(@settings) + @connection = ::HTTP2::Client.new(@settings) @connection.on(:frame, &method(:on_frame)) @connection.on(:frame_sent, &method(:on_frame_sent)) @connection.on(:frame_received, &method(:on_frame_received)) @connection.on(:origin, &method(:on_origin)) @connection.on(:promise, &method(:on_promise)) @@ -307,10 +307,10 @@ @streams.delete(request) if error ex = Error.new(stream.id, error) ex.set_backtrace(caller) - response = ErrorResponse.new(request, ex, request.options) + response = ErrorResponse.new(request, ex) request.response = response emit(:response, request, response) else response = request.response if response && response.is_a?(Response) && response.status == 421