1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/net/http.rb (Net::HTTP#connect): use

OpenSSL::SSL::SSLContext.build instead of SSLContext.new (default
  verify mode is now OpenSSL::SSL::VERIFY_PEER).

* lib/net/https.rb: SSL parameters are defined by attr_accessor.

* test/net/http/test_https.rb: add test for HTTPS features.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
gotoyuzo 2007-12-20 16:21:22 +00:00
parent d86caf3188
commit c6920177f3
5 changed files with 139 additions and 51 deletions

View file

@ -1,4 +1,9 @@
require 'webrick'
begin
require "webrick/https"
rescue LoadError
# SSL features cannot be tested
end
require 'webrick/httpservlet/abstract'
module TestNetHTTPUtils
@ -35,14 +40,22 @@ module TestNetHTTPUtils
end
def spawn_server
@server = WEBrick::HTTPServer.new(
server_config = {
:BindAddress => config('host'),
:Port => config('port'),
:Logger => WEBrick::Log.new(NullWriter.new),
:AccessLog => [],
:ShutdownSocketWithoutClose => true,
:ServerType => Thread
)
:ServerType => Thread,
}
if defined?(OpenSSL) and config('ssl_enable')
server_config.update({
:SSLEnable => true,
:SSLCertificate => config('ssl_certificate'),
:SSLPrivateKey => config('ssl_private_key'),
})
end
@server = WEBrick::HTTPServer.new(server_config)
@server.mount('/', Servlet)
@server.start
n_try_max = 5