Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2023-03

html server doubts

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

duilio foschi

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

Reply by email