Re: NTLM proxy authentication? Example please?

Giganews Newsgroups
Subject: Re: NTLM proxy authentication? Example please?
Posted by:  John Cox (newsgrou…@jcentdotcom.notthispart)
Date: Mon, 8 Aug 2005

FYI:  My application uses TidHTTP components to "get" files from many web
servers as part of its normal operation.  I have many users in a dozens of
different corporate and government environments.  Some installations use
HTTP proxy servers.  Of those, some require authentication, usually using
Windows integrated security (this is NTLM, I guess).

I'd like my application to handle proxy servers (and whatever authentication
that's necessary) transparently to the user.

So far, I've been able to determine the proxy settings from WinInet, using
InternetQueryOption().  I set the server and port in ProxyParams and things
work OK when authentication is not required.

Now, how do I authenticate to the proxy server?  My user is already logged
into windows and has no trouble browsing with IE. Their IT guy says the
proxy is set up to use NTLM.

This code works fine when using proxies that do not require authentication
and when no proxy is used at all.  What must I change/add to get it to work
with NTLM authenticated proxy servers?

var
  HTTP: TIdHTTP;
begin
  HTTP := TidHttp.Create(nil);
  try
    SetProxy(HTTP);//this sets ProxyParams, if needed
    Result := Http.Get(aURL);
  except
    on E:Exception do
      Result := '';
  end;
  HTTP.Free;
end;

Replies

None

In response to

NTLM proxy authentication? Example please? posted by John Cox on Mon, 8 Aug 2005