On Dec 1, 1:02 am, Jim Clark <diegosl... / gmail.com> wrote:
> I have rewritten my net/http script that I had questions on a couple of
> days ago using httpclient but am stuck on the NTLM authentication piece.
> This is what I have so far:
>
> #!c:/ruby/bin/ruby.exe
> CERT_FILE = "c:/certs/jim_nopw2.pem"
> CA_CERT = "c:/ca_certs/servers_ca.cer"
>
> require 'rubygems'
> require 'httpclient'  # using v2.1.2 and rubyntlm 0.1.1 installed
>
> client = HTTPClient.new
> client.ssl_config.set_trust_ca(CA_CERT)
> client.ssl_config.set_client_cert_file(CERT_FILE, CERT_FILE)
>
> # This fetches the page but 401 error because not authenticated through NTLM
> resp = client.get("https://some_website.com/default1.asp")
>
> # Not sure how to turn on NTLM authentication and feed arguments. I
> tried this but still get 401 error
> #resp = client.request('GET', "https://some_website.com/default1.asp",
> {'username' => 'DOMAIN\username', 'password' => 'password'})
> puts resp.content
> puts resp.status
>
> Thanks again for any and all help.
>
> -Jim

There are examples included in the rubyntlm gem. I'm running Windows
so they're in C:\ruby\lib\ruby\gems\1.8\gems\rubyntlm-0.1.1\examples\.
YMMV.