On Dec 2, 3:11 pm, yermej <yer... / gmail.com> wrote:
> On Dec 2, 5:07 am, Jim Clark <diegosl... / gmail.com> wrote:
>
> > If Hiroshi or anyone else getsNTLMworking, please provide an example
> > script to show how it's done. I'd love to use this library because I
> > like what I see in httpclient.
>
> > Regards,
> > Jim
>
> I don't have anNTLMserver to test against at this point, but from
> looking at the code you might want to try (with the original
> httpclient.rb) calling set_auth on the client rather than passing in
> an extra header, thusly:
>
> 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)
>
> client.set_auth(nil, 'DOMAIN\username', 'password')
>
> resp = client.get("https://some_website.com/default1.asp")
> puts resp.content
> puts resp.status
>
> I think I'll be able to play with this once I'm back at work tomorrow.
> I'll post more if I can get it working. As you said, all the pieces
> are there, it's just a matter of figuring out how to use them
> correctly.

I've played with this some and there seem to be a couple problems. Or
I'm just doing things completely wrong.

It seems that calling set_auth with the first parameter as nil should
end up setting the @auth_default instance variable in the
NegotiateAuth object. It does not. So, using the target URL as the
first parameter is the first step to getting things almost working.

Once I did that, I was getting to the response stage of the
authentication, but it wasn't successful. At this point, that seems
like it might be a problem with the way HTTPClient uses rubyntlm or it
might not support the version our server is using or...

It's a bit soon to say, but it seems that there might be a bug in
HTTPClient. I'll post again once I've figured it out.