You are not logged in.
Pages: 1
What? We don't have audio processing in mORMot
@ab, you started this with your 1.0594631 constant...
Thanks Arnaud for your valuable response.
I have tried to implement a package using mormot.core.variants and a VCL application using this package dynamically. Everything works as expected without my changes to the mormot.core.variants. Difficult to blame Delphi RTL for a problem in this case given that we are using a custom/proprietary plugin framework. I simply need to put more effort into debugging if this framework does something out of ordinary.
I am using Delphi 11 and latest mORMot2. When closing an application I have a memory leak pointing to mormot.core.variants. The exception is almost the same as in this topic: Memory leak starting rev. 179, with the exception of TObject.DisposeOf being called last in the call stack.
But, we have a proprietary/custom made plugin framework (host application is loading bpl's at the runtime) and this memory leak is happening only when using this framework inside a bpl loaded by the host and not when using mormot.core.variants directly in the host. Given this situation I did my own analysis and made a fix for which I need your opinion.
Problem seems to be in the SynVariantTypes array and "my fix" was to simply add the DeInitializeUnit at the end of mormot.core.variants:
procedure DeInitializeUnit;
var
i: integer;
begin
SynVariantTypesSafe.Lock;
try
for i := 0 to length(SynVariantTypes) - 1 do
begin
SynVariantTypes[i].Free;
end;
finally
SynVariantTypesSafe.UnLock;
end;
end;
initialization
InitializeUnit;
finalization
DeInitializeUnit;
Is it OK to do it like this? Am I making some huge mistake by doing it like this? Would it harm to have this code in the official release of mORMot2 so I don't have to patch it every time we update the library?
Thanks,
+adnan
Thanks Arnaud!
Indeed, HTTP is a prime example of a custom TCP protocol
I would like to create my own application (instead of the one delivered by a vendor) that communicates with a proprietary system.
They are using a custom/proprietary TCP protocol, but luckily I have a Wireshark dissector for it.
My question is if anyone can give me some hints/tips/starting points in how to achieve this in mORMot2?
My guess is that I will spend a lot of time in mormot.net.sock unit but if someone has a public repo or an example of how one defines custom TCP header, message length bytes etc.. it would be really helpful.
Thanks,
+adnan
I think I found the solution for this.
Once you instantiate a TJwtCrypt class (or similar) you can set Options to [joHeaderParse].
In case I am doing it wrong, please let me know.
Thanks,
+adnan
I am just giving keycloak as an example of a problem.
Keycloak generates a JWT with the following header, for example:
{
"alg": "RS256",
"typ": "JWT",
"kid": "Ov1FFK-avlBR40w6MHNNdCkR5Rl4QcL-STw7h2H11fc"
}
When parsing token this if line is activated in mormot.crypt.jwt, line 1074:
if (toklen <= headerlen) or
not CompareMem(pointer(fHeaderB64), tok, headerlen) then
exit;
I suspect that fHeaderB64 is created with the following "template" in mind:
if fHeader = '' then
FormatUtf8('{"alg":"%","typ":"JWT"}', [aAlgorithm], fHeader);
Any idea what would be a recommended course of action for me here?
Thanks!
Works for both Win32 and Win64.
THandle is defined as following in System.pas
THandle = NativeUInt;
which I guess explains the problem with -1 as an initial value.
In case it is of interest to someone:
Software version tested: 2.1.5802 (2023-08-30 09:00:57)
Windows 10 64bit (10.0.19045) [WinAnsi 15.8GB 4A651701]
4 x Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz 4MB cache (x86)
on LENOVO 20J4000XMX ThinkPad L470
Using mORMot 2.1.5802
TSqlite3LibraryStatic 3.42.0 with internal MM
Generated with: Delphi 12 Next 32 bit Win compiler
Time elapsed for all tests: 4m04
Total assertions failed for all test suits: 0 / 77,927,545
! All tests passed successfully.
Software version tested: 2.1.5802 (2023-08-30 09:16:02)
Windows 10 64bit (10.0.19045) [WinAnsi 15.8GB 4A651701]
4 x Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz 4MB cache (x64)
on LENOVO 20J4000XMX ThinkPad L470
Using mORMot 2.1.5802
TSqlite3LibraryStatic 3.42.0 with internal MM
Generated with: Delphi 12 Next 64 bit Win compiler
Time elapsed for all tests: 4m21
Total assertions failed for all test suits: 0 / 77,892,415
! All tests passed successfully.
In order to compile mormot2tests I had to make a minor change in the mormot.net.sock.pas file on lines 4699 and 4721, changing:
Handle := {$ifdef FPC}THandle{$endif}(-1);
to
Handle := {$ifdef FPC}THandle{$endif}(0);
The original code raise the following error:
[dcc64 Error] mormot.net.sock.pas(4699): E1012 Constant expression violates subrange bounds
Not sure if my "fix" is the best one, but "it works"™
Thanks for making mORMOt a "future-proof" framework.
Pages: 1