switched from http-2 to http-2-next

This commit is contained in:
HoneyryderChuck 2019-11-17 02:21:00 +00:00
parent 24171b044a
commit b969a1afe0
3 changed files with 5 additions and 21 deletions

View File

@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = HTTPX::VERSION
gem.add_runtime_dependency "http-2", ">= 0.9.0"
gem.add_runtime_dependency "http-2-next", ">= 0.1.1"
gem.add_runtime_dependency "timers"
gem.add_development_dependency "http-form_data", ">= 2.0.0", "< 3"
gem.add_development_dependency "http-cookie", "~> 1.0"

View File

@ -1,29 +1,13 @@
# frozen_string_literal: true
require "io/wait"
require "http/2"
require "http/2/next"
module HTTPX
class Connection::HTTP2
include Callbacks
include Loggable
if HTTP2::VERSION < "0.10.1"
module HTTP2Extensions
refine ::HTTP2::Client do
def receive(*)
send_connection_preface
super
end
def <<(*args)
receive(*args)
end
end
end
using HTTP2Extensions
end
Error = Class.new(Error) do
def initialize(id, code)
super("stream #{id} closed with error: #{code}")
@ -116,7 +100,7 @@ module HTTPX
end
def init_connection
@connection = HTTP2::Client.new(@options.http2_settings)
@connection = HTTP2Next::Client.new(@options.http2_settings)
@connection.on(:frame, &method(:on_frame))
@connection.on(:frame_sent, &method(:on_frame_sent))
@connection.on(:frame_received, &method(:on_frame_received))

View File

@ -25,7 +25,7 @@ module HTTPX
upgrade_request.headers.add("connection", "upgrade")
upgrade_request.headers.add("connection", "http2-settings")
upgrade_request.headers["upgrade"] = "h2c"
upgrade_request.headers["http2-settings"] = HTTP2::Client.settings_header(upgrade_request.options.http2_settings)
upgrade_request.headers["http2-settings"] = HTTP2Next::Client.settings_header(upgrade_request.options.http2_settings)
wrap { send_requests(*upgrade_request, h2c_options).first }
responses = send_requests(*requests, h2c_options)
@ -111,7 +111,7 @@ module HTTPX
end
module FrameBuilder
include HTTP2
include HTTP2Next
module_function