0

I have to use Delphi 2006. I have to use Indy 10.1.5 - comes with Delphi 2006 or not, but I have to use these versions! I found an example how to use indy SSL https get but now I completely lost my head and close to to do another 'bad day' video! Finally, the SSL library loaded without any problem.

But... Why I get always 'EidReadTimeout with message 'Read Timeout' here is my code:

var
    IdHTTP1: TIdHTTP;
    ParamStringList: TStringList;
    s1: String;
    IdSSLIOHandlerSocket1: TIdSSLIOHandlerSocketOpenSSL;
begin
    IdHTTP1 := TIdHTTP.Create(nil);
    IdSSLIOHandlerSocket1 := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
    IdSSLIOHandlerSocket1.ReadTimeout := 10000;

    IdHTTP1.IOHandler := IdSSLIOHandlerSocket1;
    IdHTTP1.ConnectTimeout := 10000;
    IdSSLIOHandlerSocket1.SSLOptions.Method := sslvSSLv23; // Which one is the good for...
    IdSSLIOHandlerSocket1.SSLOptions.Mode := sslmClient;
    IdSSLIOHandlerSocket1.SSLOptions.VerifyMode := [];
    IdSSLIOHandlerSocket1.SSLOptions.VerifyDepth := 0;

    ParamStringList := TStringList.Create;
    ParamStringList.Text := '';
    s1 := IdHTTP1.Post('https://msp.f-secure.com/web-test/common/test.html', ParamStringList);
    Memo1.Text := s1;
    ParamStringList.Free;
    IdSSLIOHandlerSocket1.Free;
    IdHTTP1.Free;
end;

Any idea? What can I missed? I changed the timeout between 3 and 100 seconds, but no changes when I tried to ran my code.

Thanks in advance!

RRUZ
  • 134,889
  • 20
  • 356
  • 483
Kefealo
  • 21
  • 3
  • 1
    You should not be setting the `IOHandler.ReadTimeout` directly, set `IdHTTP1.ReadTimeout` instead and let it internally propagate to the `IOHandler`. Also, is the `EIdReadTimeout` actually escaping into your code and catchable with a `try/except` block? If not, then `TIdHTTP` is handling it internally, and you are simply seeing the debugger report it before `TIdHTTP` sees it. Lastly, you should be using `try/finally` blocks to avoid memory leaks if errors do occur. – Remy Lebeau Nov 25 '14 at 18:04
  • Agreed, It's only a _test_! And yes, I know in my code doesn't contains try/finally try/except blocks, but it's only a test! Not a production code! – Kefealo Nov 29 '14 at 08:15
  • Even test code should do things the right way to avoid skewing results. – Remy Lebeau Nov 29 '14 at 17:10
  • The forst problem is, from inside the network I cannot test my app because firewall config problems... From the internet - I have a good connection, and working! Thanks – Kefealo Dec 08 '14 at 09:16

0 Answers0