[Lazarus] html server doubts

duilio foschi octopushole at gmail.com
Mon Mar 13 22:33:51 CET 2023

I wrote a BE server expanding the TTestHTTPServer I found in the samples.

Each inbound call is handled by (common) code that sets a number of
global variables like sessionID, url, method etc.

Then the call call goes thru the Match function of several specialized
components. When the Match function of component X returns TRUE, this
component is the one that does the rest of processing:, i.e. read the
incoming payload (in case of a POST), read the inline parameters (in
case of a GET), query the DB, write a result etc

Now I wonder if this working is safe for a server that handles
multiple calls. I mean: the inbound calls are produced by visitors of
a website.

Say a call produced by visitor A comes in at time T1 and immediately
after it (at time T2) a call produced by visitor B reaches the server,
the global variables will be rewritten possibly before the first
processing is completed, what could cause havoc.

Shouldn't the memory used for each call be different? Shouldn't I use threads?

Or - due to some magics of class TFPHTTPServer - is the memory
_already_ different at each new call?

I hope I did not say something too stupid...

Peppe Polpo

More information about the lazarus mailing list