In a fictitious web application ...
What happens to the request? Does the server continue to prepare the response? Does the response arrive to the browser?
The server will continue to prepare the response. When it tries to send the response to the client, it'll fail. When this actually happens will probably depend on the actual application server implementation, whether the response is buffered etc.
In Java EE app servers (Tomcat and WebLogic, probably others as well), you'll get the following exception:
java.net.SocketException: Connection reset by peer: socket write error
PHP understands three states of connection: NORMAL, ABORTED and TIMEOUT. You can change PHP's policy on ABORTED connections (by default, the script is terminated) with the ignore_user_abort() function. From the notes section:
"PHP will not detect that the user has aborted the connection until an attempt is made to send information to the client."
Note that if your server's output is buffered, a send may not occur immediately.
See PHP's page on connection handling for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With