Parent

Files

Net::HTTP

Public Instance Methods

old_request(req, body=nil, &block) click to toggle source
Alias for: request
request(req, body=nil, &block) click to toggle source
     # File lib/net/ntlm_http.rb, line 819
819:                 def request req, body=nil, &block
820:                         resp = data = auth_data = nil
821:                         old_request req, body do |resp|
822:                                 unless Net::HTTPUnauthorized === resp and auth_data = req.auth_data and
823:                                         auth_data[0] == :ntlm and resp['www-authenticate'] == 'NTLM' ||
824:                                         data = resp['www-authenticate'][/^NTLM (.*)/, 1]
825:                                         data = false
826:                                         yield resp if block_given?
827:                                 end
828:                         end
829:                         return resp if data == false
830:                         # not really sure if i'm supposed to just rewrite the request like this?

831:                         # and the body? what about redirects? the resp.content is just the text error message

832:                         # what about post data?

833:                         req.reuse
834:                         unless data
835:                                 # first stage handshake. respond to challenge

836: #                               puts "* authenticating (0) ..."

837:                                 # this time wait is true.

838:                                 req.ntlm_auth(*auth_data[1..2])
839:                                 request req, body, &block
840:                         else
841: #                               puts "* authenticating (1) ..."

842:                                 challenge = Net::NTLM::Message.decode64 data
843:                                 # challenge.target_name could be provided back as a prompt.

844:                                 # maybe if password is unspecified, a callback can be used to provide

845:                                 # a user prompt.

846:                                 resp = challenge.response({:user => auth_data[1], :password => auth_data[2]}, {:ntlmv2 => true})
847:                                 req['Authorization'] = 'NTLM ' + resp.encode64
848:                                 old_request(req, body) { |resp| yield resp if block_given? }
849:                                 resp
850:                         end
851:                 end
Also aliased as: old_request

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.