mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
moved window size to options, changed it to 16K
This commit is contained in:
parent
feac489f33
commit
94cb9b63d9
@ -12,8 +12,6 @@ module HTTPX
|
||||
"http/1.1" => HTTP1
|
||||
}
|
||||
|
||||
BUFFER_SIZE = 1 << 16
|
||||
|
||||
class << self
|
||||
def by(uri, options, &blk)
|
||||
io = case uri.scheme
|
||||
@ -31,6 +29,7 @@ module HTTPX
|
||||
def initialize(io, options, &on_response)
|
||||
@io = io
|
||||
@options = Options.new(options)
|
||||
@window_size = @options.window_size
|
||||
@read_buffer = +""
|
||||
@write_buffer = +""
|
||||
@pending = []
|
||||
|
@ -4,6 +4,7 @@ module HTTPX
|
||||
class Options
|
||||
MAX_CONCURRENT_REQUESTS = 100
|
||||
MAX_RETRIES = 3
|
||||
WINDOW_SIZE = 1 << 14
|
||||
|
||||
class << self
|
||||
def inherited(klass)
|
||||
@ -46,6 +47,7 @@ module HTTPX
|
||||
:cookies => {},
|
||||
:max_concurrent_requests => MAX_CONCURRENT_REQUESTS,
|
||||
:max_retries => MAX_RETRIES,
|
||||
:window_size => WINDOW_SIZE,
|
||||
:request_class => Class.new(Request),
|
||||
:response_class => Class.new(Response),
|
||||
:headers_class => Class.new(Headers),
|
||||
@ -77,6 +79,10 @@ module HTTPX
|
||||
self.max_concurrent_requests = max
|
||||
end
|
||||
|
||||
def_option(:window_size) do |num|
|
||||
self.window_size = Integer(num)
|
||||
end
|
||||
|
||||
%w[
|
||||
params form json body
|
||||
proxy follow ssl max_retries
|
||||
|
@ -62,6 +62,7 @@ class OptionsSpec < Minitest::Test
|
||||
:json => nil,
|
||||
:body => nil,
|
||||
:follow => nil,
|
||||
:window_size => 16_384,
|
||||
:form => {:bar => "bar"},
|
||||
:timeout => Timeout::PerOperation.new,
|
||||
:ssl => {:foo => "bar"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user