Skip to content

Commit d03283d

Browse files
hsbtko1
authored andcommitted
Raise ArgumentError with empty host url again.
Fixup ruby/ruby@dd5118f ruby/ruby@1cda414 Co-authored-by: Koichi Sasada <[email protected]>
1 parent 3b8471d commit d03283d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/net/http/generic_request.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ def initialize(m, reqbody, resbody, uri_or_path, initheader = nil)
1515

1616
if URI === uri_or_path then
1717
raise ArgumentError, "not an HTTP URI" unless URI::HTTP === uri_or_path
18-
raise ArgumentError, "no host component for URI" unless uri_or_path.hostname
18+
hostname = uri_or_path.hostname
19+
raise ArgumentError, "no host component for URI" unless (hostname && hostname.length > 0)
1920
@uri = uri_or_path.dup
2021
host = @uri.hostname.dup
2122
host << ":".freeze << @uri.port.to_s if @uri.port != @uri.default_port

0 commit comments

Comments
 (0)