mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
switched from http-2 to http-2-next
This commit is contained in:
parent
24171b044a
commit
b969a1afe0
@ -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"
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user