Has anybody managed to successfully connect to a https location via Squid proxy server setup with NTLM authentication, using Indy (10.XX) components?
I can successfully connect to http locations, however with https Indy returns an EAbort error.
Also, I can access http/https equally well if I use FreeProxy as the proxy server (开发者_JAVA百科with NTLM authentication). However Squid NTLM + https does not work? Anybody got this to work?
Thanks Rael
Here I am
1 - First of all, make sure you have updated indy's source.
2 - Download the SSL dlls from here Indy SLL DLLS and put them in your app output
3 - Make sure you have a TIdSSLIOHandlerSocketOpenSSL
connected to the TidHttp
IOHandler
property with the follow properties configured:
SSLOptions.Method := sslvSSLv23;
SSLOptions.Mode := sslmUnassigned;
OnVerifyPeer := SSLIOHandlerVerifyPeer;
SSLOptions.VerifyMode := [sslvrfPeer];
SSLOptions.VerifyDepth := 2;
4 - Write this event:
function SSLIOHandlerVerifyPeer(Certificate: TIdX509; AOk: Boolean; ADepth, AError: Integer): Boolean;
begin
Result := True;
end;
5 - Include these units to your uses clause:
IdAuthentication, IdAuthenticationDigest, IdAuthenticationNTLM
6 - Set the TidHttp.OnProxyAuthorization
event to this:
procedure IdHTTPProxyAuthorization(Sender: TObject; Authentication: TIdAuthentication; var Handled: Boolean);
begin
Handled := False;
end;
7 - Set those properties:
IndyHttpClient.HTTPOptions := IndyHttpClient.HTTPOptions + [hoKeepOrigProtocol] + [hoInProcessAuth];
IndyHttpClient.ProtocolVersion := pv1_1;
IndyHttpClient.ProxyParams.ProxyServer := 'you proxy address here'
IndyHttpClient.ProxyParams.ProxyPort := 8080;
IndyHttpClient.ProxyParams.ProxyUsername := 'your proxy username here';
IndyHttpClient.ProxyParams.ProxyPassword := 'your proxy psw here';
Now you are good to go. This code will also work with Microsoft ISA Server. If you want me to, i can send to you the full source code of my component. I will not post it here because it was written in portuguese (unless someone says its ok to post).
精彩评论