mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
test/test_puma_server_ssl.rb - add test_http_rejection
Add History.md item
This commit is contained in:
parent
ee8596237f
commit
1f439c08a9
2 changed files with 39 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
||||||
* Configuration: `environment` is read from `RAILS_ENV`, if `RACK_ENV` can't be found (#2022)
|
* Configuration: `environment` is read from `RAILS_ENV`, if `RACK_ENV` can't be found (#2022)
|
||||||
|
|
||||||
* Bugfixes
|
* Bugfixes
|
||||||
|
* Close client http connections made to an ssl server with TLSv1.3 (#2116)
|
||||||
* Do not set user_config to quiet by default to allow for file config (#2074)
|
* Do not set user_config to quiet by default to allow for file config (#2074)
|
||||||
* Always close SSL connection in Puma::ControlCLI (#2211)
|
* Always close SSL connection in Puma::ControlCLI (#2211)
|
||||||
* Windows update extconf.rb for use with ssp and varied Ruby/MSYS2 combinations (#2069)
|
* Windows update extconf.rb for use with ssp and varied Ruby/MSYS2 combinations (#2069)
|
||||||
|
|
|
@ -203,6 +203,44 @@ class TestPumaServerSSL < Minitest::Test
|
||||||
assert_match(msg, @events.error.message) if @events.error
|
assert_match(msg, @events.error.message) if @events.error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_http_rejection
|
||||||
|
body_http = nil
|
||||||
|
body_https = nil
|
||||||
|
|
||||||
|
start_server
|
||||||
|
|
||||||
|
http = Net::HTTP.new @host, @server.connected_ports[0]
|
||||||
|
http.use_ssl = false
|
||||||
|
http.read_timeout = 6
|
||||||
|
|
||||||
|
tcp = Thread.new do
|
||||||
|
req_http = Net::HTTP::Get.new "/", {}
|
||||||
|
assert_raises(Errno::ECONNREFUSED, EOFError) do
|
||||||
|
http.start.request(req_http) { |rep| body_http = rep.body }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ssl = Thread.new do
|
||||||
|
@http.start do
|
||||||
|
req_https = Net::HTTP::Get.new "/", {}
|
||||||
|
@http.request(req_https) { |rep_https| body_https = rep_https.body }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tcp.join
|
||||||
|
ssl.join
|
||||||
|
http.finish
|
||||||
|
sleep 1.0
|
||||||
|
|
||||||
|
assert_nil body_http
|
||||||
|
assert_equal "https", body_https
|
||||||
|
|
||||||
|
thread_pool = @server.instance_variable_get(:@thread_pool)
|
||||||
|
busy_threads = thread_pool.spawned - thread_pool.waiting
|
||||||
|
|
||||||
|
assert busy_threads.zero?, "Our connection is wasn't dropped"
|
||||||
|
end
|
||||||
end unless DISABLE_SSL
|
end unless DISABLE_SSL
|
||||||
|
|
||||||
# client-side TLS authentication tests
|
# client-side TLS authentication tests
|
||||||
|
|
Loading…
Add table
Reference in a new issue