mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
do not set concurrent requests at the options level, instead define it depending of the protocol
This commit is contained in:
parent
96a10828ba
commit
d5bd1c7249
@ -7,14 +7,15 @@ module HTTPX
|
||||
include Callbacks
|
||||
include Loggable
|
||||
|
||||
MAX_REQUESTS = 100
|
||||
CRLF = "\r\n"
|
||||
|
||||
attr_reader :pending
|
||||
|
||||
def initialize(buffer, options)
|
||||
@options = Options.new(options)
|
||||
@max_concurrent_requests = @options.max_concurrent_requests
|
||||
@max_requests = @max_concurrent_requests
|
||||
@max_concurrent_requests = @options.max_concurrent_requests || MAX_REQUESTS
|
||||
@max_requests = MAX_REQUESTS
|
||||
@parser = Parser::HTTP1.new(self)
|
||||
@buffer = buffer
|
||||
@version = [1, 1]
|
||||
|
@ -8,6 +8,8 @@ module HTTPX
|
||||
include Callbacks
|
||||
include Loggable
|
||||
|
||||
MAX_CONCURRENT_REQUESTS = 200
|
||||
|
||||
Error = Class.new(Error) do
|
||||
def initialize(id, code)
|
||||
super("stream #{id} closed with error: #{code}")
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
module HTTPX
|
||||
class Options
|
||||
MAX_CONCURRENT_REQUESTS = 100
|
||||
WINDOW_SIZE = 1 << 14 # 16K
|
||||
MAX_BODY_THRESHOLD_SIZE = (1 << 10) * 112 # 112K
|
||||
|
||||
@ -55,7 +54,6 @@ module HTTPX
|
||||
:fallback_protocol => "http/1.1",
|
||||
:timeout => Timeout.new,
|
||||
:headers => {},
|
||||
:max_concurrent_requests => MAX_CONCURRENT_REQUESTS,
|
||||
:window_size => WINDOW_SIZE,
|
||||
:body_threshold_size => MAX_BODY_THRESHOLD_SIZE,
|
||||
:request_class => Class.new(Request),
|
||||
|
@ -69,7 +69,7 @@ class OptionsTest < Minitest::Test
|
||||
:http2_settings => { :settings_enable_push => 0 },
|
||||
:fallback_protocol => "http/1.1",
|
||||
:headers => { "accept" => "xml", "foo" => "foo", "bar" => "bar" },
|
||||
:max_concurrent_requests => 100,
|
||||
:max_concurrent_requests => nil,
|
||||
:request_class => bar.request_class,
|
||||
:response_class => bar.response_class,
|
||||
:headers_class => bar.headers_class,
|
||||
|
Loading…
x
Reference in New Issue
Block a user