Class: HTTPClient::ProxyBasicAuth

Inherits:
BasicAuth
  • Object
show all
Defined in:
lib/httpclient/auth.rb

Instance Attribute Summary

Attributes inherited from BasicAuth

#scheme

Instance Method Summary collapse

Methods inherited from BasicAuth

#initialize, #reset_challenge, #set?

Methods included from Util

#argument_to_hash, hash_find_value, #http?, #https?, #keyword_argument, uri_dirname, uri_part_of, urify

Constructor Details

This class inherits a constructor from HTTPClient::BasicAuth

Instance Method Details

#challenge(uri, param_str = nil) ⇒ Object

Challenge handler: remember URL for response.



304
305
306
307
# File 'lib/httpclient/auth.rb', line 304

def challenge(uri, param_str = nil)
  @challengeable['challenged'] = true
  true
end

#get(req) ⇒ Object



297
298
299
300
301
# File 'lib/httpclient/auth.rb', line 297

def get(req)
  target_uri = req.header.request_uri
  return nil unless @challengeable['challenged']
  @cred
end

#set(uri, user, passwd) ⇒ Object



292
293
294
295
# File 'lib/httpclient/auth.rb', line 292

def set(uri, user, passwd)
  @set = true
  @cred = ["#{user}:#{passwd}"].pack('m').tr("\n", '')
end