[前][次][番号順一覧][スレッド一覧]

ruby-changes:42865

From: hsbt <ko1@a...>
Date: Sat, 7 May 2016 20:58:41 +0900 (JST)
Subject: [ruby-changes:42865] hsbt:r54939 (trunk): * test/webrick/test_ssl_server.rb: Added basic test for `webrick/ssl`

hsbt	2016-05-07 21:55:17 +0900 (Sat, 07 May 2016)

  New Revision: 54939

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54939

  Log:
    * test/webrick/test_ssl_server.rb: Added basic test for `webrick/ssl`

  Added files:
    trunk/test/webrick/test_ssl_server.rb
  Modified files:
    trunk/ChangeLog
Index: test/webrick/test_ssl_server.rb
===================================================================
--- test/webrick/test_ssl_server.rb	(revision 0)
+++ test/webrick/test_ssl_server.rb	(revision 54939)
@@ -0,0 +1,28 @@ https://github.com/ruby/ruby/blob/trunk/test/webrick/test_ssl_server.rb#L1
+require "test/unit"
+require "webrick"
+require "webrick/ssl"
+require_relative "utils"
+
+class TestWEBrickSSLServer < Test::Unit::TestCase
+  class Echo < WEBrick::GenericServer
+    def run(sock)
+      while line = sock.gets
+        sock << line
+      end
+    end
+  end
+
+  def test_self_signed_cert_server
+    config = {
+      :SSLEnable => true,
+      :SSLCertName => [["C", "JP"], ["O", "www.ruby-lang.org"], ["CN", "Ruby"]]
+    }
+    TestWEBrick.start_server(Echo, config){|server, addr, port, log|
+      sock = OpenSSL::SSL::SSLSocket.new(TCPSocket.new(addr, port))
+      sock.connect
+      sock.puts(server.ssl_context.cert.subject.to_s)
+      assert_equal("/C=JP/O=www.ruby-lang.org/CN=Ruby\n", sock.gets, log.call)
+      sock.close
+    }
+  end
+end
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54938)
+++ ChangeLog	(revision 54939)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat May  7 21:55:12 2016  SHIBATA Hiroshi  <hsbt@r...>
+
+	* test/webrick/test_ssl_server.rb: Added basic test for `webrick/ssl`
+
 Sat May  7 16:22:13 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* random.c (int_pair_to_real_inclusive): optimize to multiply

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]