mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Update docs for low_latency option and fix parsing issue (#2631)
* Treat low_latency=false as false instead of true Previously the binder.parse code was just checking that the low_latency key existed, but the docs (and other options) support passing options in the format `option=false`. This commit now treats `low_latency=false` as false, while still treating `low_latency` with no `=` as true * Update docs to reflect code behaviour * Skip getsockopt tests in JRuby JRuby (at least this version) doesn't support basic Socket constants or methods Ref: https://github.com/jruby/jruby/issues/3438
This commit is contained in:
parent
ffa5d56b84
commit
8c211dce3e
3 changed files with 29 additions and 2 deletions
|
@ -163,7 +163,7 @@ module Puma
|
|||
ios_len = @ios.length
|
||||
params = Util.parse_query uri.query
|
||||
|
||||
opt = params.key?('low_latency')
|
||||
opt = params.key?('low_latency') && params['low_latency'] != 'false'
|
||||
bak = params.fetch('backlog', 1024).to_i
|
||||
|
||||
io = add_tcp_listener uri.host, uri.port, opt, bak
|
||||
|
|
|
@ -201,7 +201,7 @@ module Puma
|
|||
# * Set the socket backlog depth with +backlog+, default is 1024.
|
||||
# * Set up an SSL certificate with +key+ & +cert+.
|
||||
# * Set whether to optimize for low latency instead of throughput with
|
||||
# +low_latency+, default is to optimize for low latency. This is done
|
||||
# +low_latency+, default is to not optimize for low latency. This is done
|
||||
# via +Socket::TCP_NODELAY+.
|
||||
# * Set socket permissions with +umask+.
|
||||
#
|
||||
|
|
|
@ -192,6 +192,33 @@ class TestBinder < TestBinderBase
|
|||
end
|
||||
end
|
||||
|
||||
def test_binder_parses_nil_low_latency
|
||||
skip_if :jruby
|
||||
@binder.parse ["tcp://0.0.0.0:0?low_latency"], @events
|
||||
|
||||
socket = @binder.listeners.first.last
|
||||
|
||||
assert socket.getsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY).bool
|
||||
end
|
||||
|
||||
def test_binder_parses_true_low_latency
|
||||
skip_if :jruby
|
||||
@binder.parse ["tcp://0.0.0.0:0?low_latency=true"], @events
|
||||
|
||||
socket = @binder.listeners.first.last
|
||||
|
||||
assert socket.getsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY).bool
|
||||
end
|
||||
|
||||
def test_binder_parses_false_low_latency
|
||||
skip_if :jruby
|
||||
@binder.parse ["tcp://0.0.0.0:0?low_latency=false"], @events
|
||||
|
||||
socket = @binder.listeners.first.last
|
||||
|
||||
refute socket.getsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY).bool
|
||||
end
|
||||
|
||||
def test_binder_parses_tlsv1_disabled
|
||||
skip_unless :ssl
|
||||
@binder.parse ["ssl://0.0.0.0:0?#{ssl_query}&no_tlsv1=true"], @events
|
||||
|
|
Loading…
Reference in a new issue