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

ruby-changes:2749

From: ko1@a...
Date: 15 Dec 2007 20:12:33 +0900
Subject: [ruby-changes:2749] akr - Ruby:r14240 (ruby_1_8, trunk): catch EOFError in a thread.

akr	2007-12-15 20:12:20 +0900 (Sat, 15 Dec 2007)

  New Revision: 14240

  Modified files:
    branches/ruby_1_8/test/net/http/test_https_proxy.rb
    trunk/test/net/http/test_https_proxy.rb

  Log:
    catch EOFError in a thread.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/test/net/http/test_https_proxy.rb?r1=14240&r2=14239
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/net/http/test_https_proxy.rb?r1=14240&r2=14239

Index: test/net/http/test_https_proxy.rb
===================================================================
--- test/net/http/test_https_proxy.rb	(revision 14239)
+++ test/net/http/test_https_proxy.rb	(revision 14240)
@@ -14,7 +14,10 @@
         http = proxy.new("foo.example.org", 8000)
         http.use_ssl = true
         http.verify_mode = OpenSSL::SSL::VERIFY_NONE
-        http.start
+        begin
+          http.start
+        rescue EOFError
+        end
       }
       sock = serv.accept
       proxy_request = sock.gets("\r\n\r\n")
@@ -28,12 +31,7 @@
       sock.close
     }
   ensure
-    if t
-      begin
-        t.join
-      rescue EOFError
-      end
-    end
+    t.join if t
   end
 end if defined?(OpenSSL)
  
Index: ruby_1_8/test/net/http/test_https_proxy.rb
===================================================================
--- ruby_1_8/test/net/http/test_https_proxy.rb	(revision 14239)
+++ ruby_1_8/test/net/http/test_https_proxy.rb	(revision 14240)
@@ -6,6 +6,7 @@
 
 class HTTPSProxyTest < Test::Unit::TestCase
   def test_https_proxy_authentication
+    t = nil
     TCPServer.open("127.0.0.1", 0) {|serv|
       _, port, _, _ = serv.addr
       t = Thread.new {
@@ -13,7 +14,10 @@
         http = proxy.new("foo.example.org", 8000)
         http.use_ssl = true
         http.verify_mode = OpenSSL::SSL::VERIFY_NONE
-        http.start
+        begin
+          http.start
+        rescue EOFError
+        end
       }
       sock = serv.accept
       proxy_request = sock.gets("\r\n\r\n")
@@ -24,7 +28,10 @@
         "\r\n",
         proxy_request,
         "[ruby-dev:25673]")
+      sock.close
     }
+  ensure
+    t.join if t
   end
 end if defined?(OpenSSL)
  

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

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