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
|
class TestNetHTTP_v1_2 < Test::Unit::TestCase
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'port' => 10081,
|
'port' => 0,
|
||||||
'proxy_host' => nil,
|
'proxy_host' => nil,
|
||||||
'proxy_port' => nil,
|
'proxy_port' => nil,
|
||||||
}
|
}
|
||||||
|
@ -634,7 +634,7 @@ end
|
||||||
class TestNetHTTP_v1_2_chunked < Test::Unit::TestCase
|
class TestNetHTTP_v1_2_chunked < Test::Unit::TestCase
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'port' => 10081,
|
'port' => 0,
|
||||||
'proxy_host' => nil,
|
'proxy_host' => nil,
|
||||||
'proxy_port' => nil,
|
'proxy_port' => nil,
|
||||||
'chunked' => true,
|
'chunked' => true,
|
||||||
|
@ -665,7 +665,7 @@ end
|
||||||
class TestNetHTTPContinue < Test::Unit::TestCase
|
class TestNetHTTPContinue < Test::Unit::TestCase
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'port' => 10081,
|
'port' => 0,
|
||||||
'proxy_host' => nil,
|
'proxy_host' => nil,
|
||||||
'proxy_port' => nil,
|
'proxy_port' => nil,
|
||||||
'chunked' => true,
|
'chunked' => true,
|
||||||
|
@ -750,7 +750,7 @@ end
|
||||||
class TestNetHTTPKeepAlive < Test::Unit::TestCase
|
class TestNetHTTPKeepAlive < Test::Unit::TestCase
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'port' => 10081,
|
'port' => 0,
|
||||||
'proxy_host' => nil,
|
'proxy_host' => nil,
|
||||||
'proxy_port' => nil,
|
'proxy_port' => nil,
|
||||||
'RequestTimeout' => 1,
|
'RequestTimeout' => 1,
|
||||||
|
@ -802,7 +802,7 @@ end
|
||||||
class TestNetHTTPLocalBind < Test::Unit::TestCase
|
class TestNetHTTPLocalBind < Test::Unit::TestCase
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
'port' => 10081,
|
'port' => 0,
|
||||||
'proxy_host' => nil,
|
'proxy_host' => nil,
|
||||||
'proxy_port' => nil,
|
'proxy_port' => nil,
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ module TestNetHTTPUtils
|
||||||
end
|
end
|
||||||
|
|
||||||
def config(key)
|
def config(key)
|
||||||
self.class::CONFIG[key]
|
@config ||= self.class::CONFIG
|
||||||
|
@config[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
def logfile
|
def logfile
|
||||||
|
@ -42,6 +43,7 @@ module TestNetHTTPUtils
|
||||||
end
|
end
|
||||||
|
|
||||||
def spawn_server
|
def spawn_server
|
||||||
|
@config = self.class::CONFIG
|
||||||
server_config = {
|
server_config = {
|
||||||
:BindAddress => config('host'),
|
:BindAddress => config('host'),
|
||||||
:Port => config('port'),
|
:Port => config('port'),
|
||||||
|
@ -62,6 +64,7 @@ module TestNetHTTPUtils
|
||||||
@server = WEBrick::HTTPServer.new(server_config)
|
@server = WEBrick::HTTPServer.new(server_config)
|
||||||
@server.mount('/', Servlet, config('chunked'))
|
@server.mount('/', Servlet, config('chunked'))
|
||||||
@server.start
|
@server.start
|
||||||
|
@config['port'] = @server[:Port] if @config['port'] == 0
|
||||||
n_try_max = 5
|
n_try_max = 5
|
||||||
begin
|
begin
|
||||||
TCPSocket.open(config('host'), config('port')).close
|
TCPSocket.open(config('host'), config('port')).close
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue