From 0f7b26ab4e2922e767d730084cc29f713e05d126 Mon Sep 17 00:00:00 2001 From: naruse Date: Thu, 8 Mar 2018 16:07:54 +0000 Subject: Raise ArgumentError if host component is nil From: oss92 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 --- lib/net/http/generic_request.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/net/http/generic_request.rb b/lib/net/http/generic_request.rb index a78ec16431..3ff6d88f0c 100644 --- a/lib/net/http/generic_request.rb +++ b/lib/net/http/generic_request.rb @@ -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 -- cgit v1.2.3