Package: mpm-itk / 2.4.7-02-1.1+deb8u1

01-close-socket-in-correct-process.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Index: mpm-itk-2.4.7-02/mpm_itk.c
===================================================================
--- mpm-itk-2.4.7-02.orig/mpm_itk.c
+++ mpm-itk-2.4.7-02/mpm_itk.c
@@ -209,6 +209,7 @@ int itk_fork_process(conn_rec *c)
         have_forked = 1;
         ap_close_listeners();
         ap_run_process_connection(c);
+        ap_lingering_close(c);
 	exit(0);
     default: /* parent; just wait for child to be done */
 	do {
@@ -226,6 +227,17 @@ int itk_fork_process(conn_rec *c)
 	    exit(1);
 	}
 
+	/*
+	 * It is important that ap_lingering_close() is called in the child
+	 * and not here, since some modules (like mod_ssl) needs to know the state
+	 * from earlier in the connection to be able to finish correctly.
+	 * However, we close the socket itself here so that we don't keep a
+	 * reference to it around, and then set the socket pointer to NULL so
+	 * that when prefork tries to close it, it goes into early exit.
+	 */
+	apr_socket_close(ap_get_conn_socket(c));
+	ap_set_core_module_config(c->conn_config, NULL);
+
         /* make sure the MPM does not process this connection */
 	return OK;
     }