We would like to have finer control over the connections that we serve in the Apache 2.2 C ++ module (on CentOS 5).
One of the connections should remain alive for several several queries, so we set KeepAlive to On and set a short save period.
But for each such connection, we have a few more connections from the browser that we do not need to leave, but instead want to force them to close after one request.
Some of these connections are on different ports (so we can distinguish them by port, since KeepAlive can be configured for each virtual host), and some request a different URL (so we can specify the path and parameters that we don’t want leave them behind).
Also for the one we want to keep alive, we know that after a certain request we would like to close it.
But for now, the only way to “cancel” keep-alive is to send a polite “Connection: close” header to the client. If a client behaves badly or is malicious, then he can keep him open and spend our resources.
Is there any way to tell Apache to close the connection from the server side? The documentation recommends just closing (2) the socket call, since Apache needs to do some cleanup before that. But is there some kind of API or trick to “override” the KeepAlive On static configuration dynamically (and convince Apache to call close (2))?
Thanks.
source share