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.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index cfa0de6b74..69698c4e2d 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -564,16 +564,26 @@ module URI
end
end
- # Returns the user component.
+ # Returns the user component (without URI decoding).
def user
@user
end
- # Returns the password component.
+ # Returns the password component (without URI decoding).
def password
@password
end
+ # Returns the user component after URI decoding.
+ def decoded_user
+ URI.decode_uri_component(@user) if @user
+ end
+
+ # Returns the password component after URI decoding.
+ def decoded_password
+ URI.decode_uri_component(@password) if @password
+ end
+
#
# Checks the host +v+ component for RFC2396 compliance
# and against the URI::Parser Regexp for :HOST.