summaryrefslogtreecommitdiff
path: root/test/net/http/utils.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/net/http/utils.rb')
-rw-r--r--test/net/http/utils.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/net/http/utils.rb b/test/net/http/utils.rb
index 50f616f29f..db01b18ddd 100644
--- a/test/net/http/utils.rb
+++ b/test/net/http/utils.rb
@@ -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'),
@@ -61,6 +63,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