Problem using idHttp and squid proxy

Giganews Newsgroups
Subject: Problem using idHttp and squid proxy
Posted by:  Samuel Soldat (samuel.sold…@audio-data.de)
Date: Wed, 01 Sep 2010

After updating Indy from version 10.5.7 (revision unknown) to 10.5.8 I
have a problem to get a http page via http proxy.

My code is:

IdHTTP.Request.UserAgent := 'Mozilla/3.0';
IdHTTP.Request.Pragma := 'no-cache';
IdHTTP.Request.CacheControl := 'no-cache';
IdHTTP.ProxyParams.ProxyServer := FProxy;
IdHTTP.ProxyParams.ProxyPort := FProxyPort;
IdHTTP.ConnectTimeout := 10000;
IdHTTP.ReadTimeout := 10000;
WebContent := IdHTTP.Get('http://' + FHostname + FSite);

I get the Exception:
"Im Projekt Upload.exe ist eine Exception der Klasse
EIdHTTPProtocolException mit der Meldung '' aufgetreten."

The real response text of the proxy is "403 forbidden". This is because
IdHttp now use "CONNECT" instead of "GET". I solved the problem by
changing the line 1518 in idHTTP.pas

if ARequest.UseProxy in [ctProxy, ctSSLProxy] then begin

back to

if ARequest.UseProxy=ctSSLProxy then begin

This line was modified in the revision 4280.

--
regards
Samuel Soldat

Replies