Skip to content

Commit

Permalink
Fix reference to URI::REGEXP::PATTERN::HOST
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
byroot authored and jeremyevans committed Jul 23, 2024
1 parent 15a9391 commit 0c600e1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/webrick/httprequest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,10 @@ def parse_uri(str, scheme="http")
return URI::parse(uri.to_s)
end

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

def read_body(socket, block)
Expand Down

0 comments on commit 0c600e1

Please sign in to comment.