aboutsummaryrefslogtreecommitdiffstats
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
commit900546717ef0be7fcc991575e99659d9a9d11144 (patch)
treeddd3594496fdafc60ba70de34306024b32c1d223
parentf5883fbe87ebb92cc65e9c71af433d704e8f0dc3 (diff)
downloadruby-900546717ef0be7fcc991575e99659d9a9d11144.tar.gz
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@11604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/open-uri.rb3
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5596eed304..da981eb422 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Jan 31 14:45:54 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/open-uri.rb (OpenURI::OpenURI.open_uri): use user and
+ password from URI unless http_basic_authentication is specified
+ explicitly. [ruby-core:10114]
+
Tue Jan 30 17:01:21 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* string.c (rb_str_sub_bang): calling rb_str_modify() should be just
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 56c78f0468..1ccb4f2614 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 ||