diff options
-rw-r--r-- | test/webrick/test_httpproxy.rb | 58 |
1 files changed, 48 insertions, 10 deletions
@@ -6,7 +6,6 @@ require "webrick/httpproxy" begin require "webrick/ssl" require "net/https" - require File.expand_path("../openssl/utils.rb", File.dirname(__FILE__)) rescue LoadError # test_connect will be skipped end @@ -124,12 +123,19 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase exts = [ ["keyUsage", "keyEncipherment,digitalSignature", true], ] - cert = OpenSSL::TestUtils.issue_cert( - subject, key, 1, Time.now, Time.now + 3600, exts, - nil, nil, OpenSSL::Digest::SHA1.new - ) return cert - end if defined?(OpenSSL::TestUtils) def test_connect # Testing CONNECT to proxy server @@ -139,7 +145,7 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase # 2. ---- establish SSL session ---> # 3. ------- GET or POST ----------> # - key = OpenSSL::TestUtils::TEST_KEY_RSA1024 cert = make_certificate(key, "127.0.0.1") s_config = { :SSLEnable =>true, @@ -178,7 +184,7 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase } } } - end if defined?(OpenSSL::TestUtils) def test_upstream_proxy # Testing GET or POST through the upstream proxy server @@ -246,7 +252,7 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase assert_equal(3, proxy_handler_called, up_log.call + log.call) assert_equal(3, request_handler_called, up_log.call + log.call) - if defined?(OpenSSL::TestUtils) # Testing CONNECT to the upstream proxy server # # client -------> proxy -------> proxy -------> https @@ -254,7 +260,7 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase # 2. -------- establish SSL session ------> # 3. ---------- GET or POST --------------> # - key = OpenSSL::TestUtils::TEST_KEY_RSA1024 cert = make_certificate(key, "127.0.0.1") s_config = { :SSLEnable =>true, @@ -287,4 +293,36 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase } } end end |