Server side processing of web requests

Situation: a user clicks on a link, the server receives a request and starts processing it. Meanwhile the user clicks on another link, the server receives a new request while processing the first. What's happening? On the client side, we only see the webpage from the second request, but is this the process from the first request killed on the server when the second is received? And is it server or language driven (Apache or PHP)?

+1


a source to share


3 answers


Depends. Unless the browser disconnects the connection to the server, it has absolutely no idea that the client has moved to a different location. If it disconnects the connection, then up to the webserver select it to detect and interrupt the processing flow or not.



Either way, that's the nature of HTTP statelessness. You should not rely on anything in this regard.

+5


a source


Both requests are served (if the browser sent a second one).

You will only see the second page, but if you look at the access_log, you will definitely notice two requests.



How HTTP works.

+1


a source


You can use ignore_user_abort()

to tell the script to continue (or not) after the connection has been completed.

0


a source







All Articles