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.



321
322
323
324
325
326
# File 'lib/httpclient/auth.rb', line 321

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

#get(req) ⇒ Object



312
313
314
315
316
317
318
# File 'lib/httpclient/auth.rb', line 312

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

#set(uri, user, passwd) ⇒ Object



305
306
307
308
309
310
# File 'lib/httpclient/auth.rb', line 305

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