Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Jun : IDHttp Basic Authentication

www.cryer.info
Managed Newsgroup Archive

IDHttp Basic Authentication

Subject:IDHttp Basic Authentication
Posted by:"Jeremy" (jere..@lanwest dot com dot au)
Date:9 Jun 2005 02:46:03

Hi,

I am running Indy 9.0.18 and am having trouble authenticating to Squid
2.5 Basic Proxy

The error I get is HTTP/1.0 503 Service Unavailable


I checked the Response Packet and found

X-Squid-Error: ERR_CONNECT_FAIL 61

I also checked the squid logs and found

TCP_MISS/503


I have tried numerous methods of setting the proxy ie


with IDHTTP do
Begin
ProxyParams.BasicAuthentication := True;
ProxyParams.ProxyUsername := sProxyUsername;
ProxyParams.ProxyServer := sProxyServer;
ProxyParams.ProxyPort := StrToInt(sProxyPort);
Get(URL);
End;


I have also tried using the OnSelectProxyAuthorization event

procedure TAdminForm.UpdateHttpSelectProxyAuthorization(Sender: TObject;
  var AuthenticationClass: TIdAuthenticationClass;
  AuthInfo: TIdHeaderList);
begin
   // First check for NTLM authentication, as you do not need to
   // set username and password because Indy will automatically
   // handle passing your Windows Domain username and
   // password to the proxy server
   if (pos('Proxy-Authenticate: NTLM',
UpdateHttp.Response.RawHeaders.Text) > 0) then
   begin
     UpdateHttp.ProxyParams.Clear;
     UpdateHttp.ProxyParams.BasicAuthentication := false;
     // Set the authentication class to NTLM
     AuthenticationClass := TIdSSPINTLMAuthentication;
   end
   else
   begin
     // Next check for Basic
     if (pos('Proxy-Authenticate: Basic',
UpdateHttp.Response.RawHeaders.Text) > 0) then
     begin
       AuthenticationClass := TIdBasicAuthentication;
       UpdateHttp.ProxyParams.BasicAuthentication := true;
     end
     else
     begin
       // Then Digest
       if (pos('Proxy-Authenticate: Digest',
UpdateHttp.Response.RawHeaders.Text) > 0) then
         AuthenticationClass := TIdDigestAuthentication

     end;
       UpdateHttp.ProxyParams.ProxyUsername := sProxyUsername;
       UpdateHttp.ProxyParams.ProxyPassword := sProxyPassword;
   end;
end;


Nothing seems to work. Does anyone have any sample code or alternatives
to authenticate to this type of proxy. I have tested it through IE and
it authenticates ok so I know there is something wrong with the
headers. Maybe I need to manually set them.

Any Help Appreciated.
Jeremy

Replies:

www.cryer.info
Managed Newsgroup Archive