diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-07 12:59:48 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-07 12:59:48 +0000 |
commit | 9f51dac2237857797435df405b00d7a8f396207d (patch) | |
tree | aa84d8f5b2ed133c0b69180b409259c91c5a6669 /lib | |
parent | 687c2efe653dbf006e4aa90122f50a9f1f267281 (diff) | |
download | ruby-9f51dac2237857797435df405b00d7a8f396207d.tar.gz |
Delay Utils.getservername until needed.
There is no need to call Utils.getservername when the :ServerName option is
specified, so delay Utils.getservername until needed to avoid unnecessary
DNS lookups. [ruby-core:78492] [Bug #13007]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/webrick/config.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/webrick/config.rb b/lib/webrick/config.rb index 98c9701633..af4b561534 100644 --- a/lib/webrick/config.rb +++ b/lib/webrick/config.rb @@ -20,8 +20,14 @@ module WEBrick LIBDIR = File::dirname(__FILE__) # :nodoc: # for GenericServer - General = { - :ServerName => Utils::getservername, + General = Hash.new { |hash, key| + case key + when :ServerName + hash[key] = Utils.getservername + else + nil + end + }.update( :BindAddress => nil, # "0.0.0.0" or "::" or nil :Port => nil, # users MUST specify this!! :MaxClients => 100, # maximum number of the concurrent connections @@ -36,7 +42,7 @@ module WEBrick :AcceptCallback => nil, :DoNotReverseLookup => true, :ShutdownSocketWithoutClose => false, - } + ) # for HTTPServer, HTTPRequest, HTTPResponse ... HTTP = General.dup.update( |