AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c);
+/**
+ * This function is responsible for the following cases:
+ * <pre>
+ * we now proceed to read from the client until we get EOF, or until
+ * MAX_SECS_TO_LINGER has passed. the reasons for doing this are
+ * documented in a draft:
+ *
+ * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
+ *
+ * in a nutshell -- if we don't make this effort we risk causing
+ * TCP RST packets to be sent which can tear down a connection before
+ * all the response data has been sent to the client.
+ * </pre>
+ * @param c The connection we are closing
+ */
+apr_status_t ap_lingering_close(void *dummy);
#endif
/* Hooks */
* all the response data has been sent to the client.
*/
#define SECONDS_TO_LINGER 2
-static apr_status_t ap_lingering_close(void *dummy)
+apr_status_t ap_lingering_close(void *dummy)
{
char dummybuf[512];
apr_size_t nbytes = sizeof(dummybuf);
if (!disconnected) {
context->accept_socket = INVALID_SOCKET;
}
+ else {
+ apr_pool_cleanup_kill(context->ptrans, c, ap_lingering_close);
+ }
}
else {
/* ap_new_connection closes the socket on failure */