Class: HTTPClient::ProxyBasicAuth

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

Instance Attribute Summary

Attributes inherited from BasicAuth

#force_auth, #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, try_require, 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.


301
302
303
304
305
306
# File 'lib/httpclient/auth.rb', line 301

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

#get(req) ⇒ Object


293
294
295
296
297
298
# File 'lib/httpclient/auth.rb', line 293

def get(req)
  synchronize {
    return nil unless @challenge['challenged']
    @cred
  }
end

#set(uri, user, passwd) ⇒ Object


287
288
289
290
291
# File 'lib/httpclient/auth.rb', line 287

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