#1 Re: mORMot 2 » E10060 with THttpClientSocket and not with Winhttp Client » 2024-03-22 08:25:42

Ty just to give more information:

On Server Side Client Connection works in both modes.
Only Clients connecting over Network get timeout error

OpenSSL is disabled, I'll try it using OpenSSL

#2 mORMot 2 » E10060 with THttpClientSocket and not with Winhttp Client » 2024-03-21 14:50:35

itSDS
Replies: 3

Hi i just switched from WinHttp to Socket client and get error 10060

Log Output

InternalUri GET
...
ESChannel {recv : Socket Error 10060}
ENetSocket {THttpClientSocket.DoTlsAfter: TLS failed ..

after a timeout of 30s

With WinHttp the connection can be established

We connect to a server with valid certificate.

I need a clou how to find the reason for the error- any thougths ?

#3 Re: mORMot 2 » Create SynCrossPlatform Wrapper with m2 broken » 2024-03-21 14:46:00

Hi thank you very much tomas, actually we have modified the mustache Template an can use it with m2. I ll report some things if we are finished

#4 Re: mORMot 2 » Create SynCrossPlatform Wrapper with m2 broken » 2024-03-20 08:39:03

Hi ttomas, thanks for the code. i directly testet it and have some results !

1. The nested records are fine now

but there are the following problems now:

1. the definition of all the dynamic array types is behind (under) the use of them in the previous defined records. (May be depending on the wrapper
2. in the variant2 and 2variant function there is something wrong added

would be easier to understand if i provide some graphics

Link with pictures

https://cloud.diestelmann-it-gmbh.de/s/LwSkbMAwJNTbD2S

#5 Re: mORMot 2 » Create SynCrossPlatform Wrapper with m2 broken » 2024-03-19 18:03:06

I testet today with the latest release - Same Error - Syncrossplatform Client can not be created with m2

#6 Re: mORMot 2 » Feature request or question concerning Certificate in Windows Storage » 2024-03-01 19:24:53

ty i tried my best but was a little confused converting from c to delphi. But now it works and certificate is found.

Now after getting the Handle the next error comes in AfterAccept:

Erste Gelegenheit für Exception bei $76CCDD80. Exception-Klasse ESChannel mit Meldung '<>: AcquireCredentialsHandleW returned 8009030E [2148074254], System Error 1312 [Eine angegebene Anmeldesitzung ist nicht vorhanden. Sie wurde gegebenenfalls bereits beendet]'.

Something about missing Credentials

#7 Re: mORMot 2 » Feature request or question concerning Certificate in Windows Storage » 2024-03-01 14:14:19

Yes certificate is in HKLM/Software/Microsoft/SystemCertificates/MY/Certificates

But CertOpenStore returns nil ...

May Be Something wrong with Parameters:

  CERT_STORE_PROV_SYSTEM = 10;
  CERT_STORE_MAXIMUM_ALLOWED_FLAG = $00001000;
  CERT_SYSTEM_STORE_CURRENT_USER =  $00010000;
  CERT_SYSTEM_STORE_LOCAL_MACHINE = $00020000;


    var LProvider : AnsiChar := #10; // CERT_STORE_PROV_SYSTEM  or CERT_STORE_MAXIMUM_ALLOWED_FLAG
    var LMy := 'MY';
    fAcceptCertStore := mormot.lib.sspi.CertOpenStore(@LProvider, 0, nil, CERT_SYSTEM_STORE_LOCAL_MACHINE, @LMy);

tried also with Admin rights / Ask for User also does not work.

#8 Re: mORMot 2 » Feature request or question concerning Certificate in Windows Storage » 2024-03-01 13:57:57

ty ab-

I'm a few steps further, Moving my Certiicate to MY private storage and looking for ThumbPrint now works:

  LsThumbPrint := '12097c0d0db94e85b83b415bc8b6aa324dcd9dc1';

  flags := Length(LsThumbPrint) div 2;
  SetLength(certblob, flags);
  HexToBinFast(PAnsiChar(LsThumbPrint), PByte(certblob), flags);
  blob.cbData := flags;
  blob.pbData := pointer(certblob);
  fAcceptCert := mormot.lib.sspi.CertFindCertificateInStore(fAcceptCertStore, X509_ASN_ENCODING or PKCS_7_ASN_ENCODING, 0, $10000, @blob, nil);
  if fAcceptCert = nil then
    raise ESChannel.Create('AfterBind: no Certificate available');

But if i use my request to local machine (See above) and then look for thmubprint does not work - may something wrong with selecting right storage

#9 Re: mORMot 2 » Feature request or question concerning Certificate in Windows Storage » 2024-03-01 10:25:04

ab wrote:

You need to use the TNetTlsContext fields.
My guess is that you need client TLS authentication using a certificate with a private key stored within the local windows storage?

But it depends on the TLS engine used.
For OpenSSL you can specify CertificateFile or other fields if needed.
For SSPI (default on Windows), you can't specify a client certificate (yet).

You can try to modify TSChannelNetTls in mormot.net.sock.windows.inc to add the ability to specify a client Certificate in TNetTlsContext.
Either as a file name or a file fingerprint using CertFindCertificateInStore(CERT_FIND_HASH).
If you need it for SSPI, I could try to implement it, and you may validate/test it.

Hi Arnaud, my certificate is stored in local Machine storage. so i tried to add it to SChannel Afterbind, but get error on start i can not explain to me:

procedure TSChannelNetTls.AfterBind(var Context: TNetTlsContext);
var
  certblob: RawByteString;
  blob: TCryptDataBlob;
  pass: SynUnicode;
  flags: integer;
begin
  if Context.CertificateFile = '' then begin
    // Load certificate and private key from Windows certificate store
//     fAcceptCertStore := CertOpenSystemStoreW(nil, 'MY')
    var LProvider : WideChar := WideChar(CERT_STORE_PROV_SYSTEM);
    var LMy := 'MY';
    fAcceptCertStore := mormot.lib.sspi.CertOpenStoreW(@LProvider, 0, nil, CERT_SYSTEM_STORE_LOCAL_MACHINE, @LMy);
  end else
  begin
    certblob := StringFromFile(TFileName(Context.CertificateFile));

At Programm start a message pops up CertOpenStoreW not found in dll (my exe name) in source is it declared as extern crypt32.dll

any idea ?

#10 Re: mORMot 2 » BUG (or new feature) on SOA Calls » 2024-03-01 08:53:45

Just for your information, yesterday i got corrupted packets at size 1.6MB with 7177
i checked it with latest version 7184 and it worked !

#11 Re: mORMot 2 » Feature request or question concerning Certificate in Windows Storage » 2024-03-01 08:08:12

Chaa wrote:

You can use certmgr.msc to import .p7b file and then export as .pfx.

i tried it, but the file does not include the private key - Export is grey for this

#12 Re: mORMot 2 » Feature request or question concerning Certificate in Windows Storage » 2024-02-29 09:38:26

Hi i have the p7b File of the Certificate can i use this ?

#13 mORMot 2 » Feature request or question concerning Certificate in Windows Storage » 2024-02-29 07:54:53

itSDS
Replies: 14

Hi Arnaud,

im Using WEBSOCKET_DEFAULT_MODE in some of my new services.
Before i used useHttpApiRegisteringURI
now i have to switch some services also using https from http to Socket mode. There was a Certificate attached to the service by fingerprint from Windows certificate storage.

I read your Blog with detailed information on how to setup the tls:
https://blog.synopse.info/?post/2022/07 … WebSockets

Is it possible to use the Certificate from Windows Storage as TLS Parameter ?
Or is there a way to export it to give tls the cert files ?

#14 Re: mORMot 2 » BUG (or new feature) on SOA Calls » 2024-02-28 18:15:39

But one question, i set HTTPSERVER_DEBUG_OPTIONS in TRestHttpServer.Create(...
But fDebugLog in mormot.net.async - procedure TPollAsyncSockets.ProcessWrite(  const notif: TPollSocketResult; sent: integer); is nil an no Debug written,
where should i set rsoLogVerbose ?

#15 Re: mORMot 2 » BUG (or new feature) on SOA Calls » 2024-02-28 18:09:59

Hi Arnaud i can confirm that it works now as expected. Thank you !

#16 Re: mORMot 2 » BUG (or new feature) on SOA Calls » 2024-02-28 07:36:34

Question, i saw lot of DoLOG lines in the Socket Code, how can i activate it ? May be i can find the Error on the server

#17 Re: mORMot 2 » BUG (or new feature) on SOA Calls » 2024-02-27 20:08:24

I switched Server to useHttpApiRegisteringURI and the Request works as before. So definitelly a server problem with WEBSOCKETS_DEFAULT_MODE

#18 Re: mORMot 2 » BUG (or new feature) on SOA Calls » 2024-02-27 20:03:21

I think the Problem is on the Server Side,

i digged a little Deeper
i swiched client to Socket Client and put FileFromString in mormot.net.http GetBody line 4266:

  if Http.CompressContentEncoding >= 0 then
    Http.UncompressData;
  if Assigned(OnLog) then
    OnLog(sllTrace, 'GetBody len=%', [Http.ContentLength], self);

  FileFromString(http.Content, 't:\sockresp.txt');

  if SockIn <> nil then

the received data is corrupted. In Former test i used WinHttp Client.

#19 Re: mORMot 2 » BUG (or new feature) on SOA Calls » 2024-02-27 19:31:00

i wrote resp in File (Line 724 mormot.soa.client) and the same value as in log i described further, Log is correct.

    begin
      FileFromString(resp, 't:\resp.txt', true);
      if (JsonDecode(pointer(resp), ['result', // 0
                                     'id'      // 1

#21 Re: mORMot 2 » BUG (or new feature) on SOA Calls » 2024-02-27 19:15:27

Hi Arnaud, i debugged the code and compared V 2.2.6792 with 2.2.7166

with 7166 the parser said - Error in File, so i compared the Log Outputs from 6792 and 7166 both Server Side and Client Side.
6792 works as expected. But in 7166 Client Log the JSON Buffer was corrupted after Byte 524288, is there a Buffer to small ? My Data has in all cases 692979 Byte !

The Client got 692979 Byte but after Byte 524288 was a copy starting at byte 262144
There Seems to be a buffer Problem in the 7166 client

#22 mORMot 2 » BUG (or new feature) on SOA Calls » 2024-02-27 13:51:45

itSDS
Replies: 14

Hi Arnaud, today i get an error calling a simple SOA function:

here a part of the log:

27.02.2024 14:36:12.224	Enter	1	 mormot.soa.client.TServiceFactoryClient(18f37450).InternalInvoke IDomBelegverwaltung.GetAlleAuftraege("",1) 1
27.02.2024 14:36:12.224	Enter	1	    mormot.rest.http.client.TRestHttpClientWinHttp(18f738a0).InternalUri POST
27.02.2024 14:36:12.256	Client	1	       mormot.rest.http.client.TRestHttpClientWinHttp(18f738a0) POST LSYS/DomBelegverwaltung.GetAlleAuftraege/1?session_signature=000d4a4f0018aa4462b2baf2 status=200 len=692979 state=5
27.02.2024 14:36:12.256	Leave	1	    00.039.894
27.02.2024 14:36:12.256	Service return	1	    mormot.soa.client.TServiceFactoryClient(18f37450) {"result":[[{State:2,Anlagedatum:"2023-09-20T10:53:14",LetzteAenderung:"2023-12-14T15:08:53",....
27.02.2024 14:36:12.256	Leave	1	 00.046.140
27.02.2024 14:37:45.976	Exception	1	 EInterfaceFactory {Message:"TInterfacedObjectFakeClient.FakeCall(IDomBelegverwaltung.GetAlleAuftraege) failed: 'Invalid returned JSON content: expects {result:...}, got {\"result~:[[{State:2,Anlagedatum:\"2023-09-20T10:53:14\",LetzteAenderung:\"2023-12-14T15:08:53

As you can see the server sends everything ok, but in last line instead of result: there is \"result~: and other Strings are also escaped.

Not every SOA Call has this behavior, may be it depends on the amount of Data received.

#23 Re: mORMot 2 » Using Async Socket to Refresh Client » 2023-12-18 18:30:48

Hi Arnaud,, forget my last question, i read in other posts in the forum that the callback like approach will not work with WebSockets.
I'll do it in a different way smile

#24 Re: mORMot 2 » Using Async Socket to Refresh Client » 2023-12-18 12:05:55

Hi i have implemented a client Server for windows now. And the next step is to be notified on a Webpage using WebSocket

i tried it but WebSocket does not connect. So created a litte sample for your restws_chatserver.exe. But also can not connect.
Is there a sample on how to connect to that kind of WebSocket from JavaSript/html ?

I like to do something similar as with the ChatClient
Calling Join Funktion and receive the Chat in the Callback.

Sample (copied from : SimpleEchoServer - mormot1) but here i try to connect to Chatserver.

function init(){
  try
  {
    socket = new WebSocket("ws://localhost:8888/root/","synopsebin");
    log('WebSocket - status '+socket.readyState);
    socket.onopen    = function(msg){
		console.log(msg); 
		log("onopen: Welcome - status "+this.readyState); 
	};
    socket.onmessage = function(msg){ 
		console.log(msg); 
		log("onmessage: ("+msg.data.length+" bytes): " + (msg.data.length < 5000 ? msg.data : (msg.data.substr(0, 30) + '...'))); 
	};
    socket.onerror   = function(msg){ 
		console.log(msg); 
		log("onerror - code:" + msg.code + ", reason:" + msg.reason + ", wasClean:" + msg.wasClean + ", status:" + this.readyState); 
	};
    socket.onclose   = function(msg){ 
		console.log(msg); 
		log("onclose - code:" + msg.code + ", reason:" + msg.reason + ", wasClean:" + msg.wasClean + ", status:" + this.readyState); 
	};
  }
  catch(ex)
  {
    log(ex);
  }
  $("msg").focus();
}

ty

#25 Re: mORMot 2 » Using Async Socket to Refresh Client » 2023-12-13 19:46:45

I think i can solve it with the Samples from m2: ex/rest-websockets.

#26 mORMot 2 » Using Async Socket to Refresh Client » 2023-12-13 19:11:29

itSDS
Replies: 5

Hi Ab, is there a simple Solution to this Idea:

Lets say i have 10(or more) client showing data from my Server received with some SOA Calls.
Now one of the clients does some updates on the data and sends it to the server, using SOA - Update call.

Now i like the Server to inform the Client about data changes, to display the changed data.
I don't like to pull the Data every 5s from the client.
i like to have a kind of Push message from the Server to the clients interested in this message.

The Client could also be a Webseite using WebSockets.

Is it possible to use the same port as the SOA Server for the Socket Server or do i need a second port ?

i read this: https://blog.synopse.info/?post/2022/05 … n-mORMot-2

#27 Re: mORMot 2 » AutoReconnect in NewStatementPrepared does not work as expected » 2023-10-24 18:15:48

Ty Arnaud, for me it works now. Using the Cache is not so Important than a successful reconnect - for Performance.
Our Trafic is very low.

#28 mORMot 2 » AutoReconnect in NewStatementPrepared does not work as expected » 2023-10-24 12:18:47

itSDS
Replies: 2

Hi we have some Reconnect Problem (Backend is MySQL with UniDAC) by auth?/Username=

Let me Explain
We Connect a SOA Client with mormot Authentication.

For test Reason i build up a Query Cache by Calling 20 SOA - Calls from my SOA Client.
Then i disconnect/connect my MySQL Server (To Force a Connection lost)

After this the First SOA Call returns with Error 403 (unknown user)
(Here NewStatementPrepared finds the Statement: NewStatementPrepared(select ID,LogonName,DisplayName,PasswordHashHexa,GroupRights from DFSQLAuthUser where LogonName=? limit 1) in Cache and returns without Reconnect

The Next SOA Call works because NewStatementPrepared does a Reconnect.

What do you think ? Is there an Error in the Authentication because it does not reconnect ?

Here is a Screenshot from the Log: https://ufile.io/su7052wv

#29 mORMot 2 » Create SynCrossPlatform Wrapper with m2 broken » 2023-08-24 07:33:19

itSDS
Replies: 7

Hi Arnaud,

i like to remember to this Problem postet before:

https://synopse.info/forum/viewtopic.php?id=5835)

it would be nice to have the possibility to produce SynCrossplatform Client with m2 - is there any progress to expect ?

br

#31 mORMot 2 » howto quick check if Server is available » 2023-07-21 09:12:25

itSDS
Replies: 3

May be this is already discussed, but i don't know...

Im looking for an fast and resource - saving way to check if my Server is reachable.
like a ping.
is there something contained in mormot ?

#32 mORMot 2 » Stack Overflow in LogView » 2023-07-03 20:04:22

itSDS
Replies: 1

Hi Arnaud,

i get Stack Overflow in Log Viewer (64Bit) Not (32Bit) - Where Should i send the Log file ?

#33 mORMot 2 » Mobile SOA Client » 2023-06-15 11:07:40

itSDS
Replies: 1

Hi Arnaud,

im Thinking about to Replace SynCrossPlatform Client mainly for SOA - WebServices (from Mormot2)

Actually i use Windows Client which works Perfectly with it. But now i like to use this on Android/iOS Client without SynCrossPlatform Wrapper.
(One of the Reason is as in one of my former tickets - That i can not build SynCrossplatform Client for mormot2 (https://synopse.info/forum/viewtopic.php?id=5835))

The Client is very easy - Connect / SetUser
Then call the Interface functions.

But the whole interface seems to be optimized by Assembler Code.
For my Mobile i do not need that much speed, so i think a PUREPASCAL Implementation could be enough here. (And it will be automatically work on iOS / Android)

Is it Possible to build a Client for Mobile for this ? Or are there any plans ?

#34 Re: mORMot 2 » Utf8ToString does not support Chinese » 2023-05-11 12:53:56

just for my interest
in the above sample you use Writeln( with dst as parameter
i think writeln uses an implicit cast of RawUtf8 To String or am i wrong ?

#36 mORMot 2 » Question concerning SOA "Object" Parameter » 2023-05-11 11:47:44

itSDS
Replies: 2

Hey Arnaud, we call a SOA Interface function from a client.
we have 5 "Object" Parameter and 2 are initialized with nil on the Client.
On the Server this Parameter are not set to nil, they contain an "empty" Object. Is it possible to get the "nil" parameter.
Specially if one of the Parameter is an "out" Parameter, how is it with memory Management ?

Example:

TMyObject = class TSynPersistent...

interface...

function SOAFunktion(out AResultObject : TMyObject; const AParam1, Param2, AParam3 : TMyObject; const AParam4:TMyObject = nil) : TResultRecord;

Client Calls

var LResult : TMyObject := nil;
AServer.SOAFunction(LResult, p1, p2, p3, nil);

On the Server Side all 5 Objects does contain a TMyObject, p1-3 are the desired Objects. but AResultObject and AParam4 should be nil ?!

#38 mORMot 2 » Base64Magic Missing for SynCrossPlatform Client » 2023-04-25 13:30:57

itSDS
Replies: 2

Im not pretty sure "when" it changed. but we noticed today, that RawByteStrings (member of a record) are send without JSON_BASE64_MAGIC Chars at the beginning.

SynCrossplatformJSON's Base64JSONStringToBytes testet for this by default and as it is not present my Blob is not received.
I changed the Withbase64Magic to false and my Blob is received correct.

my m2 Record looks like this:


  RRecord = packed record
    dateiname : RawUtf8;
    groesseinbytes : integer;
    dateityp : RawUtf8;         
    dateidatum : TDateTime;
    dokument : RawByteString;   // <- This Data is send without magic
  end;

On Client it looks like this:

  RRecord = record
    dateiname: String;
    groesseinbytes: Integer;
    dateityp: String;
    dateidatum: TDateTime;
    dokument: TSQLRawBlob;
  end;


function Variant2RRecord (_variant: variant): RRecord;
var _a: integer;
    _arr: PJSONVariantData;
begin
  result.dateiname := _variant.dateiname;
  result.groesseinbytes := _variant.groesseinbytes;
  result.dateityp := _variant.dateityp;
  result.dateidatum := Iso8601ToDateTime(_variant.dateidatum);
  result.dokument := VariantToBlob(_variant.dokument);
end;

Is this the new "default" behavior or is it an Error ?

#39 Re: mORMot 2 » Problem with iOS Review/App Testing » 2023-04-20 11:22:06

@AB the Tester(from Apple) can access the MVC Server from the device Safari browser, but not the soa server from our app.
Syncrossplatformclient from m1 latest release.

#40 Re: mORMot 2 » Problem with iOS Review/App Testing » 2023-04-20 11:20:35

@dcoun - the m2 server is behind a iis reverse proxy, and is encrypted with https and Letsencrypt certificate

#41 mORMot 2 » Problem with iOS Review/App Testing » 2023-04-20 08:39:25

itSDS
Replies: 4

Hi alltogether, may be one of you encounterd the same Problem with a similar case.

we use m2 as server, this server has 2 function a mvc view which can be used to browse some data and a soa webservice with function called from a syncrossplatform client.

the Tester at apple uses an iphone connected by tethering.

The Tester can open the mvc pages and browse it, but as he uses our app, no connection can be established.
I think there is a kind of content filter blocking the SOA - Traffic.

Im not so deep in network so may you can help. Is there an option to let the SOA trafic look like normal website trafic as the mvc view - for the content filter.

Or does anyone have another thougt / clue

thank you in advance

I forgot to mention, we don't have the connection Problem with many other devices...

#42 Re: mORMot 2 » TLS Error Problem » 2023-02-20 10:09:30

sry arnaud, I defined both what meens it did not work defining both defines in Projekt-Options.

#43 Re: mORMot 2 » TLS Error Problem » 2023-02-18 13:58:35

I tried now with secTLSSelfSigned - Same Error
USE_OPENSSL - Here the initialization with NewOpenSslNetTls is not called (Set breakpoint) Do i have to set some more parameter ?

One more info the self signed certificate on my develop computer uses sha256RSA

#45 Re: mORMot 2 » TLS Error Problem » 2023-02-17 12:14:12

Ty i test it this weekend

#46 Re: mORMot 2 » TLS Error Problem » 2023-02-16 19:08:33

I testet it with a similar certificate on my Develop Computer and no Error ?!

#47 Re: mORMot 2 » TLS Error Problem » 2023-02-16 18:23:59

I made some further testing (Turned on AllowDeprecatedTls on Client / On Server i don't know how - pls help)

Starting Client on same Windows Server 2019
The WinHTTP Client runs without error.
The Socket Client with same error as before ESChannel: SEC_E_INVALID_TOKEN/ERROR_INVALID_PARAMETER. As i know Win2019 supports TLS 1,1.1,1.2 as Default.

There Error comes requesting Timestamp. In Server Log is no entry concerning the connection request. Something is wrong with tls settings in Socket Client for Windows.

#48 Re: mORMot 2 » TLS Error Problem » 2023-02-16 14:21:36

i dont think its a server problem. We have older server with older m2 Versoin running, but after updating the client to Versions newer than approx. mid 1/2023 we get the error.

#49 Re: mORMot 2 » TLS Error Problem » 2023-02-16 13:14:36

The Alghorithm is md5RSA

#50 Re: mORMot 2 » TLS Error Problem » 2023-02-16 12:55:52

The Client is Windows 10
The Server Windows 2019
The Client works with our https Website (Let's Encrypt) Certificate
algo - have to check
I'll try AllowDeprecatedTLS
ty

Board footer

Powered by FluxBB