ruby-on-railsrubyntlmhttpi

httpi-ntlm gem for all three auth type


I was using httpi-ntlm ruby gem to get the RSS feeds from the given url, username and password.

I want to know if there is a way I can use all three auth types in my method so that the server picks the setting it prefers???

def get_data url,user,password
    request = HTTPI::Request.new(url)
    request.auth.ntlm(user,password)
    response = HTTPI.get request
    return  response.raw_body 
end

Solution

  • You would need to try with one request, if that fails, or you get a header back with the information on what type of authorisation to use, then you can use that auth instead.

    Several different auth types use the same Authorization header, hence why you can't send different types of auth at the same time.