You are not logged in.
itSDS wrote:i think no one will make a server on mobile platform.
Our "peer cache" feature relies on local UDP/TCP servers, and could benefit on client side too, but I don't know how it is possible on the mobile, especially about firewall port opening.
I would think about a "pure client" peercache feature, without any UDP/TCP server.
I used http server on mobile a time ago and did not have to open any port but may this changed meanwhile
I too asked this question long time ago and actually using SynCrossPlatform Client with some Patches. It works generally great.
The Problem is that you have to generate special Client.pas Unit from Server. And it would be great if this step can be removed.
for the iOS/Android it is not neccessary to port the whole m2. only the client stuff and rtti because i think no one will make a server on mobile platform.
Ty Arnaud it solves my problem
Hi Arnaud, ty for your patch.
Today we wanted to see the Result of a SOA Call in Log. In former Versions there was the complete JSON Array.
In the new m2 there is only 1 line saying Response with 1.7MB
Is it possible to add the complete JSON to Log again. We need it to debug problems. Log Size and Performance does not matter in our case ! More important is to log the Information.
A switch to enable / Disable Big Data would be ok too.
As Workaround i changed:
procedure TRest.InternalLogResponse(const aContent: RawByteString;
const aContext: shortstring; Level: TSynLogLevel);
begin // caller checked that self<>nil and sllServiceReturn in fLogLevel
// fLogFamily.Add.LogEscape(Level, '%', [aContext], pointer(aContent), length(aContent), self);
fLogFamily.Add.Log(Level, aContent, self, MAX_SIZE_RESPONSE_LOG);
end;
Hi Arnaud,
today i saw that some SOA Parameters i formerly could read are shortened now.
There was a const MAX_SIZE_RESPONSE_LOG which i changed to a larger Value
now this const is not used any more and at the places it was formerly used InternalLogResponse is called!
InterlogResponse uses LogEscape which uses a ShortString now an cuts all after 200 Char.
This is not very useful.
TY Daniel, this makes sense if you like to add something else to the Log.
My Question was concerning the Use of the Cast to PUtf8Char
Hi Arnaud i have a may be stupid question how to handle your Change in TSynLog.DoLog/Enter in our Programs
you changed one Parameter from RawUtf8 to PUtf8Char
what is the best way to fix the Compiler Errors:
Sample 1:
old:
var XYZ: String := 'test'; // Sometimes we got String Var
TSynLog.Enter(StringToUtf8(XYZ), ...);
new:
TSynLog.Enter(PUtf8Char(StringToUtf8(XYZ)), ...); // is this the best way ?
Im not sure what this cast really does
TY looks good !
Hi As BUGFix i commented the Lines 1539-1541 in mormot.rest.mvc
result := fContext.Validate(
cookie, PRecordData, PRecordTypeInfo, PExpires, nil, Invalidate);
// if result <= 0 then
// // delete any invalid/expired cookie on server side
// Finalize;
end;
Please try with tonight's code.
It should keep track of the finalized sessions, and reject them.
I also switched the cookie signature and encryption to AES-GCM-128 which is both very fast and cryptographically secure.
As far as I can tell, there is no advantage of using a JWT in respect to our TBinaryCookieGenerator now.
Hi Arnaud, sorry i testet wrong. The Problem was not solved correctly.
I didn't provide function for fApplication.OnSessionFinalized so invalidate was not called.
But if i provide function there is an Stack Overflow generated because finalize is called recursive.
I think both Variants are to complicated. I genereate ContentSecurityPolicy in GetViewInfo which generates 2 Nonce Values for script and style
This both values i give to mustache {{main.cspnonce}}
if i use callback it is called after mvc, how could i add my nonces to main.xy ?
if i use ttomas version i have to add my code to every function, i have a lot
To make it easy, i made a little patch to TRestUriParams and added a new value: ContentSecurityPolicy
LowLevelUserAgent: RawUtf8;
/// itSDS: für ContentSecurityPolicy !
ContentSecurityPolicy: RawUtf8; // itSDS
/// initialize the non RawUtf8 values
procedure Init; overload;
Then i added a little bit of code to mormot.rest.http.server.pas
call.LowLevelUserAgent := Ctxt.UserAgent;
call.ContentSecurityPolicy := ''; // itSDS
if fHosts.Count > 0 then
Ctxt.OutCustomHeaders := call.OutHead;
if call.ContentSecurityPolicy <> '' then // itSDS
Ctxt.AddOutHeader(['Content-Security-Policy: ', call.ContentSecurityPolicy]);
if call.OutInternalState <> 0 then
what do you think ?
ty i'll try
Hi Arnaud, i like to add a different nonce for CSP to every call of GetViewInfo
Acually I put my CSP to OutCustomHeaders in HttpServer Request.
is it Possible to Access / Modify the Ctxt.OutCustomHeaders from MVCApplication ?
Thank you
I Start Service compiled for 64Bit in Debug Mode, it seems to hang, but in Log i can see that ComputeRoutes takes 99s to start.
Starting same Service from Command Line starts immediate as expected.
i saw thsi Problem before but not taking so long...
Sry i must correct me, I changed above line without effect. Make new Ticket for my problem
After disabling the AntiVirus, the Problem does not happen again, may there was a problem with the AV ?!
I think you renamed it to mormot.core.base.concat
Hi Arnaud, in latest version NetConcat is missing in mormot.net.http.pas
There was one thing, happened to me
I changed CookieName to "DIT Test" and later got error in Reverse Proxy:
Description
This violation occurs when HTTP cookies contain at least one of the following components:
- Quotation marks in the cookie name.
- A space in the cookie name.
- An equal sign (=) in the cookie name.
Note: A space between the cookie name and the equal sign (=), and between the equal sign (=) and cookie value is allowed.
- An equal sign (=) before the cookie name.
- A carriage return (hexadecimal value of 0xd) in the cookie name.
may be there should be a Check-Routine in SetCookieName throwing Exception if name does not match the rules für Cookie Names
Hi Arnaud i testet it today an it seems to be secure now, could not use deletet Cookie any more.
I have the same observation
Hi Arnaud,
i try to get RemoteIP in MVC Server.
I set RemoteIPServer either to X-Real-IP or X-Forwarded-For.
But how can i access/Request RemoteIP from function in MVC-Server ?
i tried it this way:
function TMyMVCApplication.GetCallerIPAdresse: RawUtf8;
begin
Result := FindIniNameValue(pointer(ServiceRunningContext.Request.Call.InHead), 'REMOTEIP: ');
if Length(Result) = 0 then
Result := ServiceRunningContext.Request.Call.LowLevelRemoteIP;
if Length(Result) = 0 then
Result := '127.0.0.1';
end;
But RemoteIP is empty
Thank you
I was just looking fpr a reason, that the Log Files behave the described way.
The Problem is, if the BUG occurs, the Service seems to hang for the connected clients
Hi Arnaud, today we had this Problem again, consuming also a lot of cpu cycles in the service with the Log - Problem.
I found out, that on the server running the logs, Microsoft defender was scanning the logs.
Is this a possible Reason for the Problem?
I deaktivated the Defender - Scan for our Log/Service directories.
I will report if Problem has gone or not
Yes Timeout is set to 240min
In MySQL we increased the number of allowed connections, may be there is an option in PostgresSQL
Hi Arnaud, a Pentester has tested our mvc Server !
He found this vulnerability:
He saved the Session Cookie on client Site. Logged out frrom Server (On Server CurrentSession.Finalize is called and client Cookie Removed)
But after this he used the saved Cookie to call MVC - Pages.
The Cookie is still valid.
Do you know a simple way to invalidate such cookies ?
We Create Session Cookies after Login-Funktion with CurrentSession.Initialize and check it with CurrentSession.CheckAndRetrieve
Thank you
May be its better to use TObject instead of record than null in val should be possible
Hi Arnaud, i',m back from holiday, did you change something i can test ?
atm we switched back to standard server implementation
Hi Arnaud yes i think daniel has an other problem.
I sent you new Logs today with low level logs
And yes my Problem is primary with big data packets (exact size unkown) but its reproducable in different client server scenarios.
Hi Arnaud, i checked all of this:
What do you call "request timeout"?
Is it a HTTP_TIMEOUT = 408 error code?
Yes
On server side:
Is it visible on the server side, via TRestServerUriContext.ExecuteCommand() as TimeOut method - i.e. InternalLog('TimeOut %.Execute(%) after % ms' ?
No on Server site i can see nothing
Do you use the HeaderRetrieveAbortDelay option?
No
On client side:
It may come from a long SockReceivePending()=cspNoData line 2373 of THttpClientSocket from mormot.net.client.
Is it the case?
I don't know, i will add DoLog To OnLog
And the Connection is still alive - Server is responding to other clients
Client is sending next Request if i start any
The Only Thing i observed is, that the Packed is "bigger" lets say 600KB to 2MB
@AB yes its a 408 error. I made a documented client / Server / Log and sent it to you also.
Hi Arnaud, this topic is not very easy, but i can not find the reason.
Using a m2 TRestHttpServer with WEBSOCKETS_DEFAULT_MODE and TRestHttpClientSocket only http connection
we get unexpected request timeouts on client site.
In Log we can see timestamp request to server, auth, instance and contract request.
But then using one of the interface function sometimes gives "request timeout"
On Server site we can see all as normal. but if request timeout nothing is in log on server site.
We checked firewall / content filter there should be nothing.
Do you have any idea what else we can check / Enable any extra log or so ?
Now i have ported Boilderplate to m2, just to let it run
I think your Code is Work in Progress !
The whole thing is very big so i understand, that other things are more important.
Hi Arnaud,
i would like to make the http Server more secure and like to add this Options:
X-Frame-Options
Content-Security-Policy
Permissions-Policy
Cross-Origin-Embedder-Policy
Cross-Origin-Resource-Policy
Cross-Origin-Opener-Policy
I saw in mormot.net.http.pas some Options like in Boilerplate, but no implementation. Is it missing ?
Hi Arnaud, sounds good, is there an example of mutual Authentication available ?
One other question in this context, is it possible to crypt the traffic from client with syncrossplatform client to m2 server without using ssl.
as ssl can be compromitted with man in the middle attacks
Hi Arnaud, we are asked to set secure Attribute for cookies, is this possible with m2 and how ?
ty
Sorry its
500*1024
or
1000*1024
In this case its 1000M but get same with 500M
The Content of the Log is nearly the same Just some lines added from file to file..
Hi Arnaud, here a some screens from the Logs, may be you understand now what i mean
I think there is a Problem in TSynLog.PerformRotation, May be the File can not be deleted or something else
Hi Arnaud, what do you mean ?
You need more details ?
The Problem occours not very often !
Hi Arnaud,
today we had this Problem:
TSynLog.Family.RotateFileCount := 100
TSynLog.Family.RotateFileSizeKB := 500MB
TSynLog.Family.RotateFileDailyAtHour := 23
LogSize : 946MB
And 100 Files Created each containing the Log with some few lines added
It seems that the Log is not truncated / deleted after creating the synlz
so that every synlz contains the Log beginning at the same Line but enhanced with some newly added rows.
After restarting the Service everything runs as expected
Any Idea ?
Ty for your answer, i understand that client should not wait long for answers
Hi Arnaud, i found this topic: https://synopse.info/forum/viewtopic.php?id=6249
and have a similar problem.
On Client Side i prepare a lot of Data lets say 50000 Records.
I pass them as an array of Records thru a SOA Function
The Server needs 10min to work on this records.
so i have to set my Timeouts > 10min (Send/Receive/Connect)
else a retry will occur and send the Records again.
As you wrote in the topic the server should only use ms to answer.
What will be the best approach to realise this big task ?
Should i implement an own thread handling it and send notifications during processing to client ?
Also as in topic, debugging is anoying with the retry.
What is the reason to retry the sending of data ? Should this not be handled in the SOA Call.
Good Tip thank you very much
Hi Arnaud, today i had a litte bit of time to fix the Problem.
in my Code a had lots of
TSynLog.Add.Log(sllEnter, .... (Used in Class Procedure)
But there is no automatically genereted sllLeave
LogView uses a recursive function: ComputeProperTime to calc times
This was called to often.
i made to things:
1. i increased the Stack Size of LogView with Compiler Switch: {$M 16384,4194304}
2. i changed the sllEnter to sllDebug
How can i use sllEnter in class functions/procedures to get runtime ?
Should i manually add sllLeave ?
Just to end this Ticket, with OPENSSL Version the Connection coulf be establiched.
One Thing: if i copy only the first dll (libcrypto...) and Libssl is missing, the Error Message should be like: libssl.. is missing ...
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