Class: Net::HTTP

### Home Classes Methods

### In Files

- lib/net/ntlm_http.rb

### Parent

Object

### Methods

- #old_request
- #request

### Files

- README

### Class/Module Index

Quicksearch

- Net
- Net::HTTP
- Net::HTTPHeader
- Net::HTTPRequest
- Net::NTLM
- Net::NTLM::Field
- Net::NTLM::FieldSet
- Net::NTLM::Int16LE
- Net::NTLM::Int32LE
- Net::NTLM::Int64LE
- Net::NTLM::Message
- Net::NTLM::Message::Type1
- Net::NTLM::Message::Type2
- Net::NTLM::Message::Type3
- Net::NTLM::SecurityBuffer
- Net::NTLM::String

No matching classes.

# 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
                    def request req, body=nil, &block
                            resp = data = auth_data = nil
                            old_request req, body do |resp|
                                    unless Net::HTTPUnauthorized === resp and auth_data = req.auth_data and
                                            auth_data[0] == :ntlm and resp['www-authenticate'] == 'NTLM' ||
                                            data = resp['www-authenticate'][/^NTLM (.*)/, 1]
                                            data = false
                                            yield resp if block_given?
                                    end
                            end
                            return resp if data == false
                            # not really sure if i'm supposed to just rewrite the request like this?

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

                            # what about post data?

                            req.reuse
                            unless data
                                    # first stage handshake. respond to challenge

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

                                    # this time wait is true.

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

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

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

                                    # a user prompt.

                                    resp = challenge.response({:user => auth_data[1], :password => auth_data[2]}, {:ntlmv2 => true})
                                    req['Authorization'] = 'NTLM ' + resp.encode64
                                    old_request(req, body) { |resp| yield resp if block_given? }
                                    resp
                            end
                    end

Also aliased as: old_request

[Validate]

Generated with the Darkfish Rdoc Generator 2.