Re:How to use TIdHttp and proxy?
Quote
"Bent" <b...@halvari.no> wrote in message
news:3eafbb18$1@newsgroups.borland.com...
Quote
> We are using indy version 9.00.10.
> I've tried to set these values(ex):
> Host := any web adress.
> Port := 80
> ProxyParams.ProxyServer:= proxyserver.
> ProxyParams.ProxyPort := 8080
> with and without BasicAuthentication, ProxyUserName and Proxypassword.
> And if I try to call get(Url) - methode, it fails, it only resolving the
> proxyserver and telling me that the page cannot be viewed. If I try the
> connect methode it resolves the proxy server and the webadress.
> Is there anyone that can telling me how to use indy components with
> proxy,any examples?
> Regards
> Bent Atle B.
I have had the same problem and I figured out that the password and username
can be set in the
following event:
procedure TfrmInternet.HTTPProxyAuthorization(Sender: TObject;
Authentication: TIdAuthentication; var Handled: Boolean);
begin
if frmProxyUser.ShowModal = mrOK then begin
Authentication.Password := ProxyPassword;
Authentication.Username := ProxyUserID;
HTTP.ProxyParams.BasicAuthentication := True;
end;
The function frmProxyUser.ShowModal asks for the ProxyPassword en
ProxyUserID.
This method works on a MS-ISA (proxy) server.
I discovered also that the Indy version (9.0.10) contains a bug when using
proxy authorization.
When you specify a faulty username and or password, the program loops
because it resets the password to nothing.
I commented out that section and my application works now perfect.
The Section commented out is:
File: idHTTP.pas
Lines 1155- 1158
// Clear password and reset autorization if previous failed
{ if (AResponse.FResponseCode = 407) then begin
ProxyParams.ProxyPassword := '';
ProxyParams.Authentication.Reset;
end;
Greetings
Henk van Hoek
Exencia Learning Solutions