summaryrefslogtreecommitdiff
path: root/lib/uri/generic.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-15 02:41:45 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-15 02:41:45 +0000
commitdb38fea37fb2f40399cac3b239f4955d78f8347c (patch)
treea4cfecfc0204110a8fc937e1209f8555cb29439d /lib/uri/generic.rb
parent713920f74eed65b16f777bd76f56098ea927aee0 (diff)
* lib/uri/generic.rb (URI::Generic::userinfo): should support
empty password. [ruby-core:10290] * lib/uri/generic.rb (URI::Generic::set_password): password can be cleared by nil. [ruby-core:10290] * lib/uri/common.rb (escape): regard second string argument as a character set properly. [ruby-dev:27692] * lib/uri: Lovely RDOC patches from mathew (metaATpoboxDOTcom). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/uri/generic.rb')
-rw-r--r--lib/uri/generic.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index 51c2bf17f6..cae6169190 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -12,6 +12,7 @@ module URI
#
# Base class for all URI classes.
+ # Implements generic URI syntax as per RFC 2396.
#
class Generic
include URI
@@ -336,7 +337,7 @@ module URI
protected :set_user
def set_password(v)
- set_userinfo(@user, v)
+ @password = v
v
end
protected :set_password
@@ -355,7 +356,9 @@ module URI
private :escape_userpass
def userinfo
- if !@password
+ if @user.nil? or @user.empty?
+ nil
+ elsif @password.nil? or @password.empty?
@user
else
@user + ':' + @password