1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Build proper url instead of interpolating in Puma::DSL#port (#2521)

Fixes the issue with `puma -b ::1`
This commit is contained in:
Slava Kardakov 2021-01-04 20:43:45 +03:00 committed by GitHub
parent 3bee53840c
commit 94b2ecb436
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View file

@ -12,6 +12,7 @@
* Fix compiler warnings, but skipped warnings related to ragel state machine generated code ([#1953])
* Fix phased restart errors related to nio4r gem when using the Puma control server (#2516)
* Add `#string` method to `Puma::NullIO` ([#2520])
* Fix binding via Rack handler to IPv6 addresses (#2521)
## 5.1.1 / 2020-12-10

View file

@ -257,7 +257,7 @@ module Puma
# port 9292
def port(port, host=nil)
host ||= default_host
bind "tcp://#{host}:#{port}"
bind URI::Generic.build(scheme: 'tcp', host: host, port: Integer(port)).to_s
end
# Define how long persistent connections can be idle before Puma closes them.

View file

@ -95,6 +95,14 @@ class TestUserSuppliedOptionsHostIsSet < Minitest::Test
assert_equal ["tcp://#{user_host}:#{user_port}"], conf.options[:binds]
end
def test_ipv6_host_supplied_port_default
@options[:Host] = "::1"
conf = Rack::Handler::Puma.config(->{}, @options)
conf.load
assert_equal ["tcp://[::1]:9292"], conf.options[:binds]
end
end
class TestUserSuppliedOptionsIsEmpty < Minitest::Test