Method: HTTPClient::ProxyAuth#filter_request

Defined in:
lib/httpclient/auth.rb

#filter_request(req) ⇒ Object

Filter API implementation. Traps HTTP request and insert ‘Proxy-Authorization’ header if needed.



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/httpclient/auth.rb', line 185

def filter_request(req)
  @authenticator.each do |auth|
    next unless auth.set? # hasn't be set, don't use it
    if cred = auth.get(req)
      if cred == :skip
        # some authenticator (NTLM and Negotiate) does not
        # need to send extra header after authorization. In such case
        # it should block other authenticators to respond and :skip is
        # the marker for such case.
        return
      end
      req.header.set('Proxy-Authorization', auth.scheme + " " + cred)
      return
    end
  end
end