mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Merge pull request #2300 from alexeevit/feature/change-log-tcp-to-http
WIP Log binding on http:// for TCP bindings to make it clickable
This commit is contained in:
commit
e2b4193411
3 changed files with 10 additions and 5 deletions
|
@ -29,6 +29,7 @@
|
|||
* Daemonization has been removed without replacement. (#2170)
|
||||
* Changed #connected_port to #connected_ports (#2076)
|
||||
* Configuration: `environment` is read from `RAILS_ENV`, if `RACK_ENV` can't be found (#2022)
|
||||
* Log binding on http:// for TCP bindings to make it clickable
|
||||
|
||||
* Bugfixes
|
||||
* Close client http connections made to an ssl server with TLSv1.3 (#2116)
|
||||
|
|
|
@ -114,7 +114,7 @@ module Puma
|
|||
i.local_address.ip_unpack.join(':')
|
||||
end
|
||||
|
||||
logger.log "* #{log_msg} on tcp://#{addr}"
|
||||
logger.log "* #{log_msg} on http://#{addr}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class TestBinder < TestBinderBase
|
|||
def test_correct_zero_port
|
||||
@binder.parse ["tcp://localhost:0"], @events
|
||||
|
||||
m = %r!tcp://127.0.0.1:(\d+)!.match(@events.stdout.string)
|
||||
m = %r!http://127.0.0.1:(\d+)!.match(@events.stdout.string)
|
||||
port = m[1].to_i
|
||||
|
||||
refute_equal 0, port
|
||||
|
@ -92,9 +92,9 @@ class TestBinder < TestBinderBase
|
|||
def test_logs_all_localhost_bindings
|
||||
@binder.parse ["tcp://localhost:0"], @events
|
||||
|
||||
assert_match %r!tcp://127.0.0.1:(\d+)!, @events.stdout.string
|
||||
assert_match %r!http://127.0.0.1:(\d+)!, @events.stdout.string
|
||||
if Socket.ip_address_list.any? {|i| i.ipv6_loopback? }
|
||||
assert_match %r!tcp://\[::1\]:(\d+)!, @events.stdout.string
|
||||
assert_match %r!http://\[::1\]:(\d+)!, @events.stdout.string
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -351,13 +351,17 @@ class TestBinder < TestBinderBase
|
|||
unix: "unix://test/#{name}_server.sock"
|
||||
}
|
||||
|
||||
expected_logs = prepared_paths.dup.tap do |logs|
|
||||
logs[:tcp] = logs[:tcp].gsub('tcp://', 'http://')
|
||||
end
|
||||
|
||||
tested_paths = [prepared_paths[order[0]], prepared_paths[order[1]]]
|
||||
|
||||
@binder.parse tested_paths, @events
|
||||
stdout = @events.stdout.string
|
||||
|
||||
order.each do |prot|
|
||||
assert_match prepared_paths[prot], stdout
|
||||
assert_match expected_logs[prot], stdout
|
||||
end
|
||||
ensure
|
||||
@binder.close_listeners if order.include?(:unix) && UNIX_SKT_EXIST
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue