From 4b8883aa96ecb1878e4b3736b9379b68e4958d5b Mon Sep 17 00:00:00 2001 From: coderrr Date: Fri, 19 Nov 2010 13:48:31 +0700 Subject: [PATCH] support basic auth for Net::HTTP.get requests --- lib/net/http.rb | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lib/net/http.rb b/lib/net/http.rb index 33c88c8..9aac335 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -391,7 +391,9 @@ module Net #:nodoc: else uri = uri_or_host new(uri.hostname, uri.port).start {|http| - return http.request_get(uri.request_uri, &block) + get = Get.new(uri.request_uri) + get.basic_auth uri.user, uri.password if uri.user + return http.request(get, &block) } end end -- 1.7.2.1