Skip to content

Commit 0c600e1

Browse files
byrootjeremyevans
authored andcommitted
Fix reference to URI::REGEXP::PATTERN::HOST
Recent changes in the URI gem make it so that this constant may not be there. And I think even with older versions of the gem, it would depend on what the default parser was set to.
1 parent 15a9391 commit 0c600e1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/webrick/httprequest.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,10 @@ def parse_uri(str, scheme="http")
522522
return URI::parse(uri.to_s)
523523
end
524524

525+
host_pattern = URI::RFC2396_Parser.new.pattern.fetch(:HOST)
526+
HOST_PATTERN = /\A(#{host_pattern})(?::(\d+))?\z/n
525527
def parse_host_request_line(host)
526-
pattern = /\A(#{URI::REGEXP::PATTERN::HOST})(?::(\d+))?\z/no
527-
host.scan(pattern)[0]
528+
host.scan(HOST_PATTERN)[0]
528529
end
529530

530531
def read_body(socket, block)

0 commit comments

Comments
 (0)