mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Use 0 for webrick's port and get the actual port. [Bug #6766]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e2f75afbfb
commit
478d37da05
2 changed files with 9 additions and 6 deletions
|
@ -616,7 +616,7 @@ end
|
|||
class TestNetHTTP_v1_2 < Test::Unit::TestCase
|
||||
CONFIG = {
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 10081,
|
||||
'port' => 0,
|
||||
'proxy_host' => nil,
|
||||
'proxy_port' => nil,
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ end
|
|||
class TestNetHTTP_v1_2_chunked < Test::Unit::TestCase
|
||||
CONFIG = {
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 10081,
|
||||
'port' => 0,
|
||||
'proxy_host' => nil,
|
||||
'proxy_port' => nil,
|
||||
'chunked' => true,
|
||||
|
@ -665,7 +665,7 @@ end
|
|||
class TestNetHTTPContinue < Test::Unit::TestCase
|
||||
CONFIG = {
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 10081,
|
||||
'port' => 0,
|
||||
'proxy_host' => nil,
|
||||
'proxy_port' => nil,
|
||||
'chunked' => true,
|
||||
|
@ -750,7 +750,7 @@ end
|
|||
class TestNetHTTPKeepAlive < Test::Unit::TestCase
|
||||
CONFIG = {
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 10081,
|
||||
'port' => 0,
|
||||
'proxy_host' => nil,
|
||||
'proxy_port' => nil,
|
||||
'RequestTimeout' => 1,
|
||||
|
@ -802,7 +802,7 @@ end
|
|||
class TestNetHTTPLocalBind < Test::Unit::TestCase
|
||||
CONFIG = {
|
||||
'host' => 'localhost',
|
||||
'port' => 10081,
|
||||
'port' => 0,
|
||||
'proxy_host' => nil,
|
||||
'proxy_port' => nil,
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@ module TestNetHTTPUtils
|
|||
end
|
||||
|
||||
def config(key)
|
||||
self.class::CONFIG[key]
|
||||
@config ||= self.class::CONFIG
|
||||
@config[key]
|
||||
end
|
||||
|
||||
def logfile
|
||||
|
@ -42,6 +43,7 @@ module TestNetHTTPUtils
|
|||
end
|
||||
|
||||
def spawn_server
|
||||
@config = self.class::CONFIG
|
||||
server_config = {
|
||||
:BindAddress => config('host'),
|
||||
:Port => config('port'),
|
||||
|
@ -62,6 +64,7 @@ module TestNetHTTPUtils
|
|||
@server = WEBrick::HTTPServer.new(server_config)
|
||||
@server.mount('/', Servlet, config('chunked'))
|
||||
@server.start
|
||||
@config['port'] = @server[:Port] if @config['port'] == 0
|
||||
n_try_max = 5
|
||||
begin
|
||||
TCPSocket.open(config('host'), config('port')).close
|
||||
|
|
Loading…
Reference in a new issue