You are not logged in.
var u: TUri;
h:THttpClientSocket;
i:integer;
begin
h:=THttpClientSocket.Create;
u.From('https://user:pass@url');
h.Open(u.Server, u.Port, nlTcp, 10000, u.Https);
i:=h.Get(u.Address,0,'Authorization: Basic '+u.UserPasswordBase64); //tested also: i:=h.Get(u.Address,0,'Authorization: Basic '+u.UserPasswordBase64+#13+#10);
Response code with correct user/name password is 200 and h.http.content is empty (h.Http.ContentType is returned correct)
using no authentication or with wrong password response code is 401 and h.http.content is OK
calling h.GetBody does not help
Any ideas?
Offline
trying to debug it I found that probably it is not related to basic authentication
headers are parsed ok but Http.ContentLength is -1 and that causes the body not to be parsed
The same url works ok with Twinhttp from mormot
Last edited by dcoun (2022-03-27 09:28:06)
Offline
Offline
I sent you a message about
Offline
Offline
I think the result code was 200 and not 302
Offline
Nope. The result is 301.
So you need to set
h.RedirectMax := 10;
before the request to enable redirection.
Then we got a 200 response, but with no chunked encoding flag, nor content-length.
https://www.rfc-editor.org/rfc/rfc7230#section-3.3.3 states it should read all data until the server closes the connection.
This is a pretty inefficient way of handling the content size, and void the whole HTTP/1.1 interrest - this server is awfully coded for sure, and react as a HTTP/1.0 server.
Previous version was only reading till the connection close with HTTP/1.0 - now I have enabled it for HTTP/1.1 also.
See https://github.com/synopse/mORMot2/commit/ddb7c8d4
Offline
Thank you a lot Arnaud.
Probably, I did not noticed the redirect as I always set it automatically.
I am not sure for many about this Java server as I am not responsible for it. I can not be sure if it is due to the webserver or the firewall and authentication system that exists between.
I can assure you that all the Big and well Known company names exist between my request and this Java web server (including this O-Java server, I mentioned no names ).
Thanks again.
PS I have sent you an other gist about fpc and today's RTTI update in github did not change it. Thank you in advance.
Offline
I don't know what occurs with your RTTI problem.
I have no issue compiling the regression tests on Win32 with FPC, and run them.
Could you also compile the regression tests?
Offline
I have only the following in 1.2 Core process:
! Core process - TDocVariant
! Exception ESynVariant raised with messsage:
! TDocVariant.DispInvoke: invalid (1) call
- TDecimal128: 17,446 assertions passed 4.41ms
! Core process - BSON
! Exception EVariantInvalidOpError raised with messsage:
! Invalid variant operation
an accepted in SynDBRemote as I am not running it as admin
and the following:
3.3. Bidirectional remote connection:
- Websockets protocols: 30,000 assertions passed 18.66ms
- Run http server: 2 assertions passed 37.99ms
! - Soa callback on server side: 2,646 / 4,580 FAILED 8.81ms
! - Soa callback via json websockets: 3,969 / 6,898 FAILED 354.72ms
! - Soa callback via binary websockets: 3,969 / 6,898 FAILED 423.36ms
- Relay start: 4 assertions passed 34.62ms
! - Relay soa callback via json websockets: 3,969 / 6,899 FAILED 1.22s
- Relay connection recreate: 1 assertion passed 50.94ms
! - Relay soa callback via binary websockets: 3,969 / 6,899 FAILED 1.33s
- Relay shutdown: 2 assertions passed 279.34ms
- TRecordVersion: 20,068 assertions passed 187.54ms
Total failed: 18,522 / 82,251 - Bidirectional remote connection FAILED 3.97s
Offline
Compiling the same source for linux I am getting the following for debug mode:
An unhandled exception occurred at $000000000053BA7F:
EAccessViolation: Access violation
$000000000053BA7F REDIRECTCODE, line 4141 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.os.pas
$000000000058A79E REDIRECTRTLCALL, line 1144 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.fpc.inc
$000000000059D2DA INITIALIZEUNIT, line 8882 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas
$000000000059D329 MORMOT.CORE.RTTI_$$_init$, line 8910 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas
$000000000041A44C
and the following for release more
An unhandled exception occurred at $00000000006B7387:
EHttpSocket: MainHttpClass: No THttpRequest class known!
$00000000006B7387
Should I try FPC 2.2 with fixes?
Offline
Sounds pretty weird, since I don't have troubles with FPC 3.2.0 here, and FPC 3.2.2 was reported to work as expected a few months ago, IIRC (alfred?).
You seem to confuse the Lazarus version (2.2) and the FPC version (3.2.x) - this is the later which matters.
So perhaps try the FPC 3.2.2 with fixes branch.
FPC 3.2.0 should work directly.
And ensure you have the latest mORMot 2 source.
Offline
Few minutes ago, I installed FPC fixes with Lazarus fixes through fpcupdeluxe on a win11 pc.
Also installed latest mORMot2 sources with fpcupdeluxe.
Result: all greens on win32 mormot2tests !
Offline
maybe his lib paths are wrong and is compiling/linking older version. Check your paths and do a full clean+build.
Offline
New laptop i7-1165G7 32GB ram running Windows 11 pro 21H2 22000.556
I deleted old FPCupdeluxe directory.
Github downloaded version 2.0.116 with Github Desktop. NO other version exists in this new PC
fpcupdeluxe-i386-win32.exe downloaded from Pre-release v2.2.0i of fpcupdeluxe. Just clicked the Install/update FPC+Laz button
fpcupdeluxe: info: FPCNativeInstaller (GetModule: FPC): FPC was at revision/hash: FRET_UNKNOWN_REVISION
fpcupdeluxe: info: FPCNativeInstaller (GetModule: FPC): FPC is now at revision/hash: release_3_2_2-0-g0d122c4953
Running TotalCommander searching for '*mormot*' in fpc+Laz dir Nothing found
Lazarus 2.2.0 (rev lazarus_2_2_0-0-g4d49533f10) FPC 3.2.2 i386-win32-win32/win64
Package Mormot v2.0.1 "recompile clean" + Recompile All required
Mormot2tests clean up and build
results:
! Core process - TDocVariant
! Exception ESynVariant raised with messsage:
! TDocVariant.DispInvoke: invalid (1) call
- TDecimal128: 17,446 assertions passed 4.48ms
! Core process - BSON
! Exception EVariantInvalidOpError raised with messsage:
! Invalid variant operation
3.3. Bidirectional remote connection:
- Websockets protocols: 30,000 assertions passed 18.75ms
- Run http server: 2 assertions passed 40.16ms
! - Soa callback on server side: 2,646 / 4,580 FAILED 10.19ms
! - Soa callback via json websockets: 3,969 / 6,898 FAILED 444.18ms
! - Soa callback via binary websockets: 3,969 / 6,898 FAILED 398.09ms
- Relay start: 4 assertions passed 35.80ms
! - Relay soa callback via json websockets: 3,969 / 6,899 FAILED 1.27s
- Relay connection recreate: 1 assertion passed 64.81ms
! - Relay soa callback via binary websockets: 3,969 / 6,899 FAILED 1.39s
- Relay shutdown: 2 assertions passed 297.95ms
- TRecordVersion: 20,068 assertions passed 173.88ms
Total failed: 18,522 / 82,251 - Bidirectional remote connection FAILED 4.18s
Alfred the download/install of fpc was done 25-30min ago for your logs
Any help is welcomed. I do not want to consume anyone's time.
Offline
Don't worry. You are not wasting anybody's time.
You gave good info. Except for the manner in which you installed the mORMot2.
So, how did you install mORMot2 ?
With this info, I will try to reproduce your issue.
Offline
Returned to my old laptop (same brand Siemens) i7-6500U 16GB ram Win10 20H2 19042.906
Lazarus 2.2.0 (rev lazarus_2_2_0-7-gb938b1d561) FPC 3.2.3 i386-win32-win32/win64
Save version of mormot2 from Github upgraded today
Tests passed - all green
Mormot is installed as the following:
Packages ->Open package file -> Selected \mORMot2\packages\lazarus\mormot2.lpk -> Compile, more-recompile clean, more-recompile all required
I am starting a memory test on the laptop, but I do not believe a memory problem exists in a problems that it is reproduced exactly the same.
For FPC bug seems, it does not like my CPU?
Offline
Ok. Thanks.
Problem reproduced. Its FPC 3.2.2 itself, so current stable gives this error. FPC 3.2.3 (as per fixes on your laptop) gives all greens.
Offline
Upgraded the new laptop to Lazarus 2.2.0 (rev lazarus_2_2_0-122-gb464aafe69) FPC 3.2.3 i386-win32-win32/win64 3.2.3-609-gd9ac2f58ad
Now I have only the following RED in the test:
! External database - SynDBRemote
! Exception ESqlDBRemote raised with messsage:
! TSqlDBServerHttpApi.Create: administrator rights needed to register URI root on port 888
As administrator it gives them all green.
Last edited by dcoun (2022-03-29 13:26:44)
Offline
Thank you. finally mormot2tests is green as administrator with last fpc version with fixes.
My initial problem still exists with this fpc version too, but I will rewrite the project adding Torm classes to see which can reproduce the problem
if you have any more suggestions, please tell me.
Thank you very much again
An unhandled exception occurred at $006C5CFA:
EInvalidCast: Invalid type cast
$006C5CFA SETPARSERTYPE, line 9670 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.json.pas
$004DC185 CREATE, line 7330 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas
$004DDB11 DOREGISTER, line 8104 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas
$004DDBE2 DOREGISTER, line 8118 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas
$004DEC4D NEWINSTANCE, line 8650 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas
$004C779B CREATEEX, line 4382 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.data.pas
$006CCBE9 GLOBALCRYPTALGOINIT, line 4284 of ../../../../../Delphi/G/mORMot2/src/crypt/mormot.crypt.secure.pas
$006CA516 IMPLEMENTS, line 3305 of ../../../../../Delphi/G/mORMot2/src/crypt/mormot.crypt.secure.pas
$00750A8D INITIALIZEUNIT, line 5338 of ../../../../../Delphi/G/mORMot2/src/crypt/mormot.crypt.ecc.pas
$00750B68 MORMOT.CRYPT.ECC_$$_init$, line 5345 of ../../../../../Delphi/G/mORMot2/src/crypt/mormot.crypt.ecc.pas
$0040F064
Offline
Just for your info. The bug-report related to this FPC 3.2.2 issue. Conclusion: FPC 3.2.2 is not suited for the mORMot[2] due to this bugger.
https://gitlab.com/freepascal.org/fpc/s … sues/39438
Offline
An unhandled exception occurred at $006C5CFA: EInvalidCast: Invalid type cast $006C5CFA SETPARSERTYPE, line 9670 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.json.pas $004DC185 CREATE, line 7330 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas $004DDB11 DOREGISTER, line 8104 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas $004DDBE2 DOREGISTER, line 8118 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas $004DEC4D NEWINSTANCE, line 8650 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.rtti.pas $004C779B CREATEEX, line 4382 of ../../../../../Delphi/G/mORMot2/src/core/mormot.core.data.pas $006CCBE9 GLOBALCRYPTALGOINIT, line 4284 of ../../../../../Delphi/G/mORMot2/src/crypt/mormot.crypt.secure.pas $006CA516 IMPLEMENTS, line 3305 of ../../../../../Delphi/G/mORMot2/src/crypt/mormot.crypt.secure.pas $00750A8D INITIALIZEUNIT, line 5338 of ../../../../../Delphi/G/mORMot2/src/crypt/mormot.crypt.ecc.pas $00750B68 MORMOT.CRYPT.ECC_$$_init$, line 5345 of ../../../../../Delphi/G/mORMot2/src/crypt/mormot.crypt.ecc.pas $0040F064
Trying to debug the above in function
function TRttiJson.SetParserType(aParser: TRttiParserType; aParserComplex: TRttiParserComplexType): TRttiCustom;
The class the error happens in processing class TRawUtf8List as it arrives to its ancestor class TObjectWithCustomCreate in line 9670
n := Props.Count;
TCCHookClass(fValueClass).RttiCustomSetParser(self);
In the above before crashing the fValueClass is TCLASS($00923B70) in the debugger and (fValueClass)^ is __vtbl_ptr_type
Offline
Perhaps the class hooking does not work on this FPC revision.
Please try https://github.com/synopse/mORMot2/commit/aa341c64
Offline
Perhaps the class hooking does not work on this FPC revision.
Please try https://github.com/synopse/mORMot2/commit/aa341c64
Thanks a lot @ab, I passed this problem
I noticed that after that I had a forgotten testing Tormclass (just defined and included in the Tmodel, no action on it in my software) with the following definition:
TOrmApicities=class(Torm)
private
Fnam:string;
Fnomosid:TID;
Fact:boolean;
published
property nam:string index 250 read Fnam write Fnam;
property nomosid:TID read Fnomosid write Fnomosid;
property act:boolean read Fact write Fact;
end;
In Delphi, no error, no problem. In FPC 3.2.3 I am using now, I got an 219 runerror error during Tmodel.create in file mormot.orm.core line 9389
The problem was the TID that was not following the documentation in mormot.orm.core line 154 to have a type definition to the Torm it belongs.
I write it down as a difference in cross compiling the same code between Delphi and FPC.
Edit: The above is not a problem for me. Forget it
The problem is the now the following:
After that (only in FPC) I am getting an invalid typecast in file mormot.core.interfaces line 5349
p := pointer(TRttiCustomWrapper(rtti).fAutoCreateInterfaces);
when defining an interface service
srvdb.ServiceDefine(TwbService,[IwbService],sicPerThread).ByPassAuthentication:=true;
for the following interface:
TwbService = class(TInjectableObjectRest, IwbService)
private
protected
fTotalWorkCount: Integer;
public
procedure StartWork(const PrID: Integer; const onFinish: IwbCallback);
function TotalWorkCount: Integer;
function incDBver(const db,wid: integer):int64;
end;
initialization
GlobalInterfaceResolver.add(TypeInfo(IwbService),TwbService);
Any help welcome. Thank you in advance
Last edited by dcoun (2022-03-31 19:45:06)
Offline
About TOrmApicities, I am sorry but I don't understand the problem you had.
Forget about 3.2.3: it seems they forced runtime class type checking when class types are forced...
So TRttiCustomWrapper(rtti) is checked so that rtti is indeed a TRttiCustomWrapper - which is not the case, but it is fine because we just need to access a protected property.
Pretty weird and compatibility breaking for sure.
Offline
About TOrmApicities, I am sorry but I don't understand the problem you had.
The Fnomosid in the class was declared as TID. I changed it to Prtint and it works OK. In the documentation I read that I should not use a TID directly. I should have a "type TormtableID=TID" where the Tormtable is the orm class that has the TID and then declare the Fnomosid as TormtableID. But anyway, that is not a problem for me. I do not use joined orm classes. Mormot is so flexible that I do not needed it.
Forget about 3.2.3: it seems they forced runtime class type checking when class types are forced...
So TRttiCustomWrapper(rtti) is checked so that rtti is indeed a TRttiCustomWrapper - which is not the case, but it is fine because we just need to access a protected property.
Pretty weird and compatibility breaking for sure.
What means forget about 3.2.3. I can not compile it using 3.2 stable as you saw.
And now I can not define a service interface as you can see.
All the problems are with FPC. In Delphi 11.1 everything works as expected but I have prof edition.
I need a Linux x86-64 and arm64 mormot services, that it is the reason I am spending time to achieve FPC compilation.
What do you propose? How can I overcome it?
Last edited by dcoun (2022-03-31 19:43:01)
Offline
What do you propose? How can I overcome it?
Use the same system that Arnaud uses in production.
Setup your dedicated FPC / Lazarus environment with fpcupdeluxe
With best regards
Thomas
Offline
I have just done that: Return to FPC 3.2.0 and I have the same above problem with defining the service
Lazarus 2.2.0 (rev lazarus_2_2_0-122-gb464aafe69) FPC 3.2.0 i386-win32-win32/win64
I am having Free Pascal Compiler version 3.2.0-r47409 [2022/03/31] for i386
Which version of FPCupdeluxe installs FPC SVN 45643 (3.2.0)?
Am I missing something else?
Last edited by dcoun (2022-03-31 20:43:49)
Offline
I have managed to force fpcupdeluxe to install Free Pascal Compiler version 3.2.0-r45643 [2022/04/01] for i386
package mormot2 again with clean and build
now the mormot2tests have one RED in 1.2 core process:
! - Encode decode JSON: 1 / 431,822 FAILED 385.27ms
clean and build my project and the above error in mormot.core.interfaces line 5349 still exists
I Reverted mormot2 to 3cd541a9 ... now I have the above error in:
TCCHookClass(fValueClass).RttiCustomSetParser(self);
Last edited by dcoun (2022-03-31 21:46:28)
Offline
After some hours of sleep I think I understood my mistake.
I will re-evaluate FPC when mormot2 will be officially available. I will find my way till that happens.
I learn a lot of things the last days, many thanks for help and your time, and I apologize for my ignorance.
Now the time is very limited and I have to catch all waiting for me to finish.
Have a nice month and be careful for le poisson d' Avril.
Offline
I have managed to force fpcupdeluxe to install Free Pascal Compiler version 3.2.0-r45643 [2022/04/01] for i386
Not sure where you got that date from but 3.2.0 was released in 2020. Honestly if you're having issues just download 3.2.0 from offical freepascal webpage.
Offline
dcoun wrote:I have managed to force fpcupdeluxe to install Free Pascal Compiler version 3.2.0-r45643 [2022/04/01] for i386
Not sure where you got that date from but 3.2.0 was released in 2020. Honestly if you're having issues just download 3.2.0 from offical freepascal webpage.
I copied the first line in logs from Lazarus while compiling.
It gives the complete version of FPC that is is used and the today's date.
how I managed to do that:
I deleted old fpcupdeluxe directory with lazarus and fpc. I re-run the fpcupdeluxe executable. From fpcupdeluxe-> Setup+ -> up-right in the dialog you can enter the SVN you like to be installed
Offline
Something is definitively wrong with your setup, I am afraid... or did you change the project options, or the mORMot source (e.g. changed mormot.defines.inc conditionals)?
Offline
Something is definitively wrong with your setup, I am afraid... or did you change the project options, or the mORMot source (e.g. changed mormot.defines.inc conditionals)?
@ab I have the 3.2.0-r45643 you mention in the documentation and it does not pass the mormot2 tests. Which revision are you currently using? I can test it if a revision works for sure with mormot2
Github desktop does not show me any changed file. I will deleted the mormot2 directory and I will give it a try after downloading it again with Github
I have sent to you in the last gist my projects' options in Lazarus for compiling but please forget my project's compile and use your time to finish mormot2.
For my development needs for the moment I have Delphi and I will try to use wineconsole for small cases that need Linux. It is not efficient but it will help while waiting.
Thank you again. And I apologize for the trouble.
Offline
@dcount
No trouble. It is just a weird behavior in your computer...
I have asked
https://forum.lazarus.freepascal.org/in … 942.0.html
and
https://forum.lazarus.freepascal.org/in … 944.0.html
Offline
I can confirm that all the trouble was caused by the -CR switch in the debug mode.
I should check again the meaning of "Debug" in the dictionary
You had right.
Last edited by dcoun (2022-04-01 14:18:33)
Offline