mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Raise ArgumentError if host component is nil
From: oss92 <mohamed.o.alnagdy@gmail.com> fix https://github.com/ruby/ruby/pull/1278 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
897af5dfcd
commit
0f7b26ab4e
2 changed files with 14 additions and 0 deletions
|
@ -14,6 +14,8 @@ class Net::HTTPGenericRequest
|
|||
@response_has_body = resbody
|
||||
|
||||
if URI === uri_or_path then
|
||||
raise ArgumentError, "not an HTTP URI" unless URI::HTTP === uri_or_path
|
||||
raise ArgumentError, "no host component for URI" unless uri_or_path.hostname
|
||||
@uri = uri_or_path.dup
|
||||
host = @uri.hostname.dup
|
||||
host << ":".freeze << @uri.port.to_s if @uri.port != @uri.default_port
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue