summaryrefslogtreecommitdiff
path: root/lib/uri/generic.rb
diff options
context:
space:
mode:
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