#1 2017-12-03 14:54:34

jaclas
Member
Registered: 2014-09-12
Posts: 215

Connect to mORMot server by Indy on TCP level

I try connect to my server by Indy 10 and OpenSSL library, connecting is established, but server not response to request.

  lTCPClient: TIdTCPClient;
  lSSLIOHandler : TIdSSLIOHandlerSocketOpenSSL;
begin
  //create and configure TCPclient and SSL handler
  lSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  lSSLIOHandler.OnStatus := OnSSLStatus;
  lSSLIOHandler.OnStatusInfo := OnSSLStatusInfo;
  lSSLIOHandler.OnStatusInfoEx := OnSSLStatusInfoEx;
  lTCPClient := TIdTCPClient.Create(nil);
  lTCPClient.IOHandler := lSSLIOHandler;
  lSSLIOHandler.SSLOptions.SSLVersions := [sslvSSLv3, sslvSSLv2, sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
  lSSLIOHandler.SSLOptions.Mode := sslmClient;
  lSSLIOHandler.SSLOptions.Method := sslvSSLv23;
  lTCPClient.Host := edtServer.Text;
  lTCPClient.Port := StrToUInt(edtPort.Text);
  lSSLIOHandler.Host := edtServer.Text;
  lSSLIOHandler.Port := StrToUInt(edtPort.Text);

  //connect is established succesfuly
  lTCPClient.Connect;

  //write HTTP request (copy from other mORMot client http log)
  lTCPClient.IOHandler.WriteLn('GET /Companies/Timestamp HTTP/1.1');
  lTCPClient.IOHandler.WriteLn('Cache-Control: no-cache');
  lTCPClient.IOHandler.WriteLn('Connection: Keep-Alive');
  lTCPClient.IOHandler.WriteLn('Pragma: no-cache');
  lTCPClient.IOHandler.WriteLn('Content-Type: application/json; charset=UTF-8');
  lTCPClient.IOHandler.WriteLn('Accept: */*');
  lTCPClient.IOHandler.WriteLn('User-Agent: Mozilla/5.0 (Windows; mORMot 1.18 TWinINet)');
  lTCPClient.IOHandler.WriteLn('Host: ' + edtServer.Text + ':' + edtPort.Text);
  lTCPClient.IOHandler.WriteLn('Accept-Encoding: gzip, deflate');

 //read data from server... waiting to end of timeout, response size is zero bytes
  lReadData := lTCPClient.IOHandler.AllData;

in last line client waiting 120sec (timeout) and break waiting without receive any data.

From my Indy SSL log I get info that connection is established properly:

SSL StatusInfoEx SSL version: TLS1.2; type: [Handshake Done], Msg: [SSL negotiation finished successfully]; _type: [SSL_ST_CONNECT]
SSL StatusInfo, msg:: SSL status: "SSL negotiation finished successfully"
SSL StatusInfo, msg:: Cipher: name = ECDHE-RSA-AES256-GCM-SHA384; description = ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD
; bits = 256; version = TLSv1/SSLv3; 

What I'm doing wrong?

Offline

#2 2017-12-03 16:00:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: Connect to mORMot server by Indy on TCP level

Sounds more like a question to ask on Indy forum...
Or give us some more info on the mORMot server setup!

Offline

#3 2017-12-03 16:28:38

jaclas
Member
Registered: 2014-09-12
Posts: 215

Re: Connect to mORMot server by Indy on TCP level

Server work on HTTPAPI, on 8090 port and use SSL. Interface based sevice. Standard mORMot client work with server without problem.

from server log:

2017-12-03 17:10:43.45 http  	ss.Core.Server.Http.TssHTTPServer(0857C340) {"THttpApiServer(0853DCB0)":{"Cloned":false,"RegisteredUrl":"","HTTPQueueLength":1000,"MaxBandwidth":-1,"MaxConnections":-1,"APIVersion":"HTTP API 2.0","ServerName":"mORMot (Windows)","ProcessName":""}} initialized for
2017-12-03 17:11:38.22 http  	ss.Core.Server.Http.TssHTTPServer(0857C340) http.sys registration of https://+:8090/Companies
2017-12-03 17:11:38.22 http  	ss.Core.Server.Http.TssHTTPServer(0857C340) {"TssHTTPServer(0857C340)":{}}.AddServer({"TCompaniesRest(0822F7B0)":{"NoAJAXJSON":false,"Options":[],"HandleAuthentication":false,"BypassORMAuthentication":[],"Stats":{"StartDate":"2017-12-03 16:11:38","Success":0,"ServiceMethod":0,"ServiceInterface":0,"OutcomingFiles":0,"CurrentThreadCount":0,"Created":0,"Read":0,"Updated":0,"Deleted":0,"ClientsCurrent":0,"ClientsMax":0,"CurrentRequestCount":0,"Input":{"Bytes":0,"Text":"0 B"},"Output":{"Bytes":0,"Text":"0 B"},"InputThroughput":{"BytesPerSec":0,"Text":"0 B/s"},"OutputThroughput":{"BytesPerSec":0,"Text":"0 B/s"},"Processing":false,"TaskCount":0,"TotalTime":{"MicroSec":0,"Text":"0us"},"LastTime":{"MicroSec":0,"Text":"0us"},"MinimalTime":{"MicroSec":0,"Text":"0us"},"AverageTime":{"MicroSec":0,"Text":"0us"},"MaximalTime":{"MicroSec":0,"Text":"0us"},"PerSec":0,"Errors":0,"LastError":null},"StatLevels":["mlTables","mlMethods","mlInterfaces","mlSQLite3"],"StaticVirtualTableDirect":true,"ServerTimeStamp":135405044454}},Root=Companies,Port=api.serveraddress.pl:8090,Public=api.serveraddress.pl:8090)=true

Request from standard mORMot client is served properly:

2017-12-03 17:12:21.00 srvr  	ss.Rest.Companies.TCompaniesRest(0822F7B0)   GET Companies/TimeStamp SOA-Method -> 200 with outlen=12 in 524 us

but request from IE11 (call on host where server is run, Windows Server 2012) not respond too:

http://api.serveraddress.pl:8090/Companies/Timestamp

ps. serveraddress is fake address, I can send real address in priv post

Offline

#4 2017-12-03 17:32:05

jaclas
Member
Registered: 2014-09-12
Posts: 215

Re: Connect to mORMot server by Indy on TCP level

From SlimJet web browser I get response...

-------------

when I modify in IE address from http:// to https:// then IE work too.

Now address is:

https://api.serveraddress.pl:8090/Companies/Timestamp

but requesting via Indy TCP still not work.

Last edited by jaclas (2017-12-03 18:12:12)

Offline

#5 2017-12-03 20:02:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: Connect to mORMot server by Indy on TCP level

If it works, but with Indy, please ask on the Indy forum.... they are usually very responsive.

Offline

#6 2017-12-03 20:35:21

jaclas
Member
Registered: 2014-09-12
Posts: 215

Re: Connect to mORMot server by Indy on TCP level

I can't found Indy forum, links are dead... where is located this forum? thx for help

Offline

#7 2017-12-04 04:37:19

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Connect to mORMot server by Indy on TCP level

The Indy forum is http://forums2.atozed.com/viewforum.php?f=7, but is not accessible right now.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#8 2017-12-04 10:32:09

JD
Member
Registered: 2015-08-20
Posts: 101

Re: Connect to mORMot server by Indy on TCP level

The Atozed forum has been offline for more than a year.

The active Indy forum is in the Winsock section of the Embarcadero forum at https://forums.embarcadero.com/forum.jspa?forumID=74

JD

Offline

#9 2017-12-04 12:47:39

jaclas
Member
Registered: 2014-09-12
Posts: 215

Re: Connect to mORMot server by Indy on TCP level

Thx JD!

Offline

Board footer

Powered by FluxBB