Method: Addressable::URI#normalized_password

Defined in:
lib/addressable/uri.rb

#normalized_passwordString

The password component for this URI, normalized.

Returns:

  • The password component, normalized.



1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
# File 'lib/addressable/uri.rb', line 1002

def normalized_password
  return nil unless self.password
  return @normalized_password unless @normalized_password == NONE
  @normalized_password = begin
    if self.normalized_scheme =~ /https?/ && self.password.strip.empty? &&
        (!self.user || self.user.strip.empty?)
      nil
    else
      Addressable::URI.normalize_component(
        self.password.strip,
        Addressable::URI::NormalizeCharacterClasses::UNRESERVED
      )
    end
  end
  # All normalized values should be UTF-8
  force_utf8_encoding_if_needed(@normalized_password)
  @normalized_password
end