summaryrefslogtreecommitdiff
path: root/lib/webrick/server.rb
diff options
context:
space:
mode:
authorJohn W Higgins <wishdev@gmail.com>2020-07-26 00:25:37 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-09-24 21:31:55 +0900
commit4715a24dd277515077af441c1d31aeb2431917f5 (patch)
treea0f0311426a9ef96d59366a7fa18333ed81e3bda /lib/webrick/server.rb
parentc06eab13290757fc326bb2a6e3ac25cd53e00894 (diff)
[ruby/webrick] Ensure server port numbers are numeric and ensure they are stored as integers
https://github.com/ruby/webrick/commit/86ed621e11
Diffstat (limited to 'lib/webrick/server.rb')
-rw-r--r--lib/webrick/server.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb
index 4a6e74c..fd6b7a6 100644
--- a/lib/webrick/server.rb
+++ b/lib/webrick/server.rb
@@ -102,6 +102,9 @@ module WEBrick
@listeners = []
@shutdown_pipe = nil
unless @config[:DoNotListen]
+ raise ArgumentError, "Port must an integer" unless @config[:Port].to_s == @config[:Port].to_i.to_s
+
+ @config[:Port] = @config[:Port].to_i
if @config[:Listen]
warn(":Listen option is deprecated; use GenericServer#listen", uplevel: 1)
end