diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-12 11:56:12 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-12 11:56:12 +0000 |
| commit | e34c0c896904ea937e18f973af223e63d855a611 (patch) | |
| tree | 0a424edf41ad790fba4078b147fabc497f5df05f | |
| parent | d18a130b8b45ec4a0f1710f6d18f9cab877c26d7 (diff) | |
| download | ruby-e34c0c896904ea937e18f973af223e63d855a611.tar.gz ruby-e34c0c896904ea937e18f973af223e63d855a611.tar.xz ruby-e34c0c896904ea937e18f973af223e63d855a611.zip | |
test CA certs dir.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | test/open-uri/test_ssl.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/open-uri/test_ssl.rb b/test/open-uri/test_ssl.rb index 29c794a59..048227082 100644 --- a/test/open-uri/test_ssl.rb +++ b/test/open-uri/test_ssl.rb @@ -65,6 +65,10 @@ class TestOpenURISSL < Test::Unit::TestCase with_https {|srv, dr, url| cacert_filename = "#{dr}/cacert.pem" open(cacert_filename, "w") {|f| f << CA_CERT } + cacert_directory = "#{dr}/certs" + Dir.mkdir cacert_directory + hashed_name = "%08x.0" % OpenSSL::X509::Certificate.new(CA_CERT).subject.hash + open("#{cacert_directory}/#{hashed_name}", "w") {|f| f << CA_CERT } prxy = WEBrick::HTTPProxyServer.new({ :ServerType => Thread, :Logger => WEBrick::Log.new(NullLog), @@ -80,6 +84,13 @@ class TestOpenURISSL < Test::Unit::TestCase assert_equal("proxy", f.read) } assert_match(%r[CONNECT #{url.sub(%r{\Ahttps://}, '')} ], sio.string) + sio.truncate(0); sio.rewind + open("#{url}/proxy", :proxy=>"http://#{p_host}:#{p_port}/", :ssl_ca_cert => cacert_directory) {|f| + assert_equal("200", f.status[0]) + assert_equal("proxy", f.read) + } + assert_match(%r[CONNECT #{url.sub(%r{\Ahttps://}, '')} ], sio.string) + sio.truncate(0); sio.rewind ensure prxy.shutdown end |
