#1 2026-02-03 06:44:00

slan2026
Member
Registered: 2026-02-03
Posts: 2

TRestHttpServer mormot.core.text.pas IsInvalidHttpHeader

When I run the code in mormot2\ex\mvc-blog on my computer, an error occurs: 00000000156a25fa  # EXCOS EAccessViolation (c0000005 EXCEPTION_ACCESS_VIOLATION) [blog 2] at 5abb8e mormot.core.text.pas IsInvalidHttpHeader (10879)   {16 0.89 0.57 10GB/31.8GB 4a651701}. However, it runs normally on another computer. How can I resolve this error on my computer, or is there a part of my computer that might be malfunctioning?

Offline

#2 2026-02-03 17:55:31

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,401
Website

Re: TRestHttpServer mormot.core.text.pas IsInvalidHttpHeader

Which compiler?
Which Operating System?

Can you give more context?

Offline

#3 2026-02-03 23:45:04

slan2026
Member
Registered: 2026-02-03
Posts: 2

Re: TRestHttpServer mormot.core.text.pas IsInvalidHttpHeader

ab wrote:

Which compiler?
Which Operating System?

Can you give more context?

Delphi12.1
win10。
Additionally, I compiled it once using Lazarus, and everything went smoothly.

When I debug, the returned value is on line 8016 of the  mormot.rest.server.pas unit
//  lazarus: Call.OutHead = 'Content-Type: text/html;charset=utf-8' 
//delphi12.1:OutHead 'Content-Type: text/html;charset=utf-8'#$D#$A'ETag: "E039C149"'

Last edited by slan2026 (Yesterday 00:38:43)

Offline

#4 Yesterday 09:22:24

rvk
Member
Registered: 2022-04-14
Posts: 154

Re: TRestHttpServer mormot.core.text.pas IsInvalidHttpHeader

I wonder why that IsInvalidHttpHeader changed so much?

It used to be a simple lineair search for invalid line-breaks.
If you look at it now... it became so much more complex (and prone to errors and bugs, as is now the case).

This is the old version:
https://github.com/synopse/mORMot2/blob … .pas#L5473

This is the newer expanded version:
https://github.com/synopse/mORMot2/blob … pas#L10862

It's also strange that searching for IsInvalidHttpHeader on github doesn't give you the location of this function, while it is in the repository.

Offline

#5 Yesterday 19:18:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,401
Website

Re: TRestHttpServer mormot.core.text.pas IsInvalidHttpHeader

The old version was not correct anyway, and slower.

It is very likely that the problem comes from outside this function itself, and that Call.OutHead is incorrect.
I have tried to reproduce the issue with no success:
https://github.com/synopse/mORMot2/commit/bc3f00a03

Do you set the output headers by hand in your server?
Do you use cookies at that time?
Can you have the content of Call.OutHead when it is actually triggered?

Win32 or Win64?

Offline

#6 Today 09:42:22

rvk
Member
Registered: 2022-04-14
Posts: 154

Re: TRestHttpServer mormot.core.text.pas IsInvalidHttpHeader

I can't even compile the current trunk/master on Delphi 10.2.

First I get an error regarding UnCamelCase.
[dcc32 Error] mormot.core.rtti.pas(6253): E2250 There is no overloaded version of 'UnCamelCase' that can be called with these arguments

After fixing that (with a related fix) I get an error in this line:
[dcc32 Error] mormot.ui.pdf.pas(12254): E2029 'THEN' expected but ')' found

        if w < Trunc(R.rclBounds.Right - R.rclBounds.Left) / Canvas.fFactorX) then

This latest source from that file is from januari 27th so...
https://github.com/synopse/mORMot2/blob … pas#L12254

It's amazing how you can compile the latest mORMot2 without any problems wink wink

About the IsInvalidHttpHeader from this topic... I also couldn't reproduce this under Delphi 10.2 win64.
So hopefully @slan2026 can provide more information about the problem and debug exactly on what line the error occurs.

Offline

Board footer

Powered by FluxBB