Method: HTTPClient::BasicAuth#set
- Defined in:
- lib/httpclient/auth.rb
#set(uri, user, passwd) ⇒ Object
Set authentication credential. uri == nil for generic purpose (allow to use user/password for any URL).
247 248 249 250 251 252 253 254 255 |
# File 'lib/httpclient/auth.rb', line 247 def set(uri, user, passwd) @set = true if uri.nil? @cred = ["#{user}:#{passwd}"].pack('m').tr("\n", '') else uri = Util.uri_dirname(uri) @auth[uri] = ["#{user}:#{passwd}"].pack('m').tr("\n", '') end end |