Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jul : Delphi 2007/Indy 10 gives SSL Read Timeout error on IdHTTP

www.cryer.info
Managed Newsgroup Archive

Delphi 2007/Indy 10 gives SSL Read Timeout error on IdHTTP

Subject:Delphi 2007/Indy 10 gives SSL Read Timeout error on IdHTTP
Posted by:"Ghia" (ghia_no_spam@ghia.be)
Date:Wed, 4 Jul 2007 12:53:28

With a new project (Delphi 2007Upd1/Indy10.1.5) I need to access HTML
documents over HTTPS on the same server as in an older
(Delphi6up2/Indy9.0.14) project.
When running, I get Read Timeout and the received string is empty.
I tried my old project under Delphi2007, but this gives the same result.
I had to replace the SSLIOHandler: TIdSSLIOHandlerSocket by a
IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL, because the
component name has apparently changed.  (Why is all this renaming always
necessary between Indy versions?)
So, I have in D2007:
  object IdAntiFreeze1: TIdAntiFreeze
    Left = 48
    Top = 136
  end
  object HTTP: TIdHTTP
    OnStatus = HTTPStatus
    IOHandler = IdSSLIOHandlerSocketOpenSSL1
    OnWork = HTTPWork
    OnWorkBegin = HTTPWorkBegin
    OnWorkEnd = HTTPWorkEnd
    AllowCookies = True
    HandleRedirects = True
    ProxyParams.BasicAuthentication = False
    ProxyParams.ProxyPort = 0
    Request.ContentLength = -1
    Request.Accept = 'text/html, */*'
    Request.BasicAuthentication = False
    Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
    HTTPOptions = [hoForceEncodeParams]
    Left = 88
    Top = 168
  end
  object IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL
    OnStatus = IdSSLIOHandlerSocketOpenSSL1Status
    MaxLineAction = maException
    Port = 0
    DefaultPort = 0
    SSLOptions.Method = sslvSSLv2
    SSLOptions.Mode = sslmClient
    SSLOptions.VerifyMode = []
    SSLOptions.VerifyDepth = 0
    OnStatusInfo = IdSSLIOHandlerSocketOpenSSL1StatusInfo
    OnVerifyPeer = IdSSLIOHandlerSocketOpenSSL1VerifyPeer
    Left = 120
    Top = 168
  end

And in D6
  object IdAntiFreeze1: TIdAntiFreeze
    Left = 48
    Top = 136
  end
  object SSLIOHandler: TIdSSLIOHandlerSocket
    SSLOptions.Method = sslvSSLv2
    SSLOptions.Mode = sslmClient
    SSLOptions.VerifyMode = []
    SSLOptions.VerifyDepth = 0
    OnStatusInfo = SSLIOHandlerStatusInfo
    OnVerifyPeer = SSLIOHandlerVerifyPeer
    Left = 88
    Top = 136
  end
  object HTTP: TIdHTTP
    OnStatus = HTTPStatus
    IOHandler = SSLIOHandler
    MaxLineAction = maException
    OnWork = HTTPWork
    OnWorkBegin = HTTPWorkBegin
    OnWorkEnd = HTTPWorkEnd
    Port = 443
    AllowCookies = True
    HandleRedirects = True
    ProxyParams.BasicAuthentication = False
    ProxyParams.ProxyPort = 0
    Request.ContentLength = 0
    Request.ContentRangeEnd = 0
    Request.ContentRangeStart = 0
    Request.Accept = 'text/html, */*'
    Request.BasicAuthentication = False
    Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
    HTTPOptions = [hoForceEncodeParams]
    Left = 88
    Top = 168
  end

In a button onclick I do:
//      LoginUrl = https://xxx.yyy.zzz/login.form
//      EncodedStr = login form data
        PostData := TStringList.Create;
        try
          PostData.Add(EncodedStr);
          HTMLResp := HTTP.Post(LoginURL,PostData);
        finally
          postData.Free;
        end;
// then follows subsequent get's
         HTMLResp := HTTP.Get(BrowseURL);

The eventhandlers do nothing else as logging.
The onwork updates a progressbar and the verifypeer also logs only, but
is not called, because there isn't a certificate.

My loggings (anonymized) are:
D6:
11:48:25 Login
11:48:25 Resolving hostname xx.yyy.zzz.
11:48:25 Connecting to 999.999.999.999.
11:48:26 SSL status: "before/connect initialization"
11:48:26 SSL status: "before/connect initialization"
11:48:26 SSL status: "SSLv2 write client hello A"
11:48:26 SSL status: "SSLv2 read server hello A"
11:48:26 SSL status: "SSLv2 write client master key A"
11:48:26 SSL status: "SSLv2 client start encryption"
11:48:26 SSL status: "SSLv2 write client finished A"
11:48:26 SSL status: "SSLv2 read server verify A"
11:48:26 SSL status: "SSLv2 read server finished A"
11:48:26 SSL status: "SSL negotiation finished successfully"
11:48:26 SSL status: "SSL negotiation finished successfully"
11:48:26 Cipher: name = DES-CBC3-MD5; description =
DES-CBC3-MD5            SSLv2 Kx=RSA      Au=RSA  Enc=3DES(168) Mac=MD5
; bits = 168; version = SSLv2;
11:48:26 Connected.
11:48:26  - /login.form
11:48:27 HTTP/1.1 200 OK - /login.form
11:48:27 Disconnecting.
11:48:27 Disconnected.

In D2007
11:44:48 Login
11:44:49 Resolving hostname xxx.yyy.zzz.
11:44:49 Connecting to 999.999.999.999.
11:44:50 SSL status: "before/connect initialization"
11:44:50 SSL status: "before/connect initialization"
11:44:51 SSL status: "SSLv2 write client hello A"
11:44:51 SSL status: "SSLv2 read server hello A"
11:44:51 SSL status: "SSLv2 write client master key A"
11:44:51 SSL status: "SSLv2 client start encryption"
11:44:51 SSL status: "SSLv2 write client finished A"
11:44:51 SSL status: "SSLv2 read server verify A"
11:44:51 SSL status: "SSLv2 read server finished A"
11:44:51 SSL status: "SSL negotiation finished successfully"
11:44:51 SSL status: "SSL negotiation finished successfully"
11:44:51 Cipher: name = DES-CBC3-MD5; description =
DES-CBC3-MD5            SSLv2 Kx=RSA      Au=RSA  Enc=3DES(168) Mac=MD5
; bits = 168; version = SSLv2;
11:44:51 Connected.
11:44:54  - /login.form
11:44:54 Read Timeout

What is going wrong?
I  use the same SSLeay32.dll and libeay32.dll in both projects, which I
believe is 96m.
I tried various other SSL libs in D2007, which wouldn't load or gave the
same result.

This step is followed by a Http.get. In D6 a similar status log appears
and the page is received.
In D2007 I get a Access violation at address 004B6E8B in module
'TestServer.exe'. Read of address 00000014
In the case I modify the first call of Post in a Get, the subsequent
Get's give directly a Read Timeout (without SSL status logs).

I also tried to use the Indy 9 libs by changing in the project options
the search path, then I get a Unit IDIOHandlerSocket was compiled with a
different version of  IDBaseComponent.TidInitializerComponent.Create

Replies:

www.cryer.info
Managed Newsgroup Archive