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

Use mount_proc to avoid the delay of writing data to files.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-04-04 12:49:12 +00:00
parent 223e0212e9
commit 3f443e6115
2 changed files with 12 additions and 13 deletions

View file

@ -26,7 +26,7 @@ class TestOpenURISSL < Test::Unit::TestCase
:Port => 0})
_, port, _, host = srv.listeners[0].addr
begin
th = srv.start
srv.start
yield srv, dr, "https://#{host}:#{port}"
ensure
srv.shutdown
@ -48,7 +48,7 @@ class TestOpenURISSL < Test::Unit::TestCase
with_https {|srv, dr, url|
cacert_filename = "#{dr}/cacert.pem"
open(cacert_filename, "w") {|f| f << CA_CERT }
open("#{dr}/data", "w") {|f| f << "ddd" }
srv.mount_proc("/data", lambda { |req, res| res.body = "ddd" } )
open("#{url}/data", :ssl_ca_cert => cacert_filename) {|f|
assert_equal("200", f.status[0])
assert_equal("ddd", f.read)
@ -77,8 +77,8 @@ class TestOpenURISSL < Test::Unit::TestCase
:Port => 0})
_, p_port, _, p_host = prxy.listeners[0].addr
begin
th = prxy.start
open("#{dr}/proxy", "w") {|f| f << "proxy" }
prxy.start
srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } )
open("#{url}/proxy", :proxy=>"http://#{p_host}:#{p_port}/", :ssl_ca_cert => cacert_filename) {|f|
assert_equal("200", f.status[0])
assert_equal("proxy", f.read)