When trying to connect with SSL via a proxy server using a TidHTTP component
and a TidConnectionInterceptOpenSSL component, I received the error "Error
connecting with SSL". This was exception was raised because a connection
with the server had notbeen established, as the client had not authenticated
to the proxy.
From what I can see, connection to a proxy when using SSL takes place in the
method 'TIdHTTP.DoProxyConnectMethod'. I changed the code in there to the
following (which solved the problem):
procedure TIdHTTP.DoProxyConnectMethod(ASender: TObject);
var
sPort: string;
i: Integer; // added
begin
{
OLD CODE:
InterceptEnabled := False;
sPort := IntToStr(FTunnelProxyPort);
WriteLn('CONNECT ' + FTunnelProxyHost + ':' + sPort + ' HTTP/' +
FTunnelProxyProtocol);
WriteLn;
ReadLn;
ReadLn;
ReadLn;
InterceptEnabled := True;
InterceptEnabled := False;
sPort := IntToStr(FTunnelProxyPort);
WriteLn('CONNECT ' + FTunnelProxyHost + ':' + sPort + ' HTTP/' +
FTunnelProxyProtocol);
// Added headers which include 'Proxy-Authorization: ' header
Request.SetHeaders(FInternalHeaders);
for i := 0 to FInternalHeaders.Count - 1 do
WriteLn(FInternalHeaders[i]);
WriteLn;
ReadLn;
ReadLn;
// ReadLn; Removed - There were only two response lines from the server
InterceptEnabled := True;
end;
Could anyone tell me if there is another way of doing this(Without changing
any Indy code)?
Thanks,
Gareth Chandler