summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-31 05:47:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-31 05:47:33 +0000
commit83f7cab371a9e8a029369945bfca417ff5b99902 (patch)
treeddd3594496fdafc60ba70de34306024b32c1d223 /lib
parent0af73052b8def5b73fd3743053cfd98b6fa13798 (diff)
downloadruby-83f7cab371a9e8a029369945bfca417ff5b99902.tar.gz
ruby-83f7cab371a9e8a029369945bfca417ff5b99902.tar.xz
ruby-83f7cab371a9e8a029369945bfca417ff5b99902.zip
* lib/open-uri.rb (OpenURI::OpenURI.open_uri): use user and
password from URI unless http_basic_authentication is specified explicitly. [ruby-core:10114] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/open-uri.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 56c78f046..1ccb4f261 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -125,6 +125,9 @@ module OpenURI
options = rest.shift if !rest.empty? && Hash === rest.first
raise ArgumentError.new("extra arguments") if !rest.empty?
options ||= {}
+ if uri.user and uri.password and not options[:http_basic_authentication]
+ options[:http_basic_authentication] = [uri.user,uri.password]
+ end
OpenURI.check_options(options)
unless mode == nil ||