Is this the appropriate patch to address CAN-2004-0174 in 2.0.49?

$ cvs diff -r1.99 -r1.100 server/listen.c
Index: listen.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/listen.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -3 -p -r1.99 -r1.100
--- listen.c    9 Feb 2004 20:40:49 -0000       1.99
+++ listen.c    19 Mar 2004 11:16:03 -0000      1.100
@@ -383,6 +383,26 @@ static int ap_listen_open(apr_pool_t *po
     }
     old_listeners = NULL;
 
+#if AP_NONBLOCK_WHEN_MULTI_LISTEN
+    /* if multiple listening sockets, make them non-blocking so that
+     * if select()/poll() reports readability for a reset connection that
+     * is already forgotten about by the time we call accept, we won't
+     * be hung until another connection arrives on that port
+     */
+    if (ap_listeners->next) {
+        for (lr = ap_listeners; lr; lr = lr->next) {
+            apr_status_t status;
+
+            status = apr_socket_opt_set(lr->sd, APR_SO_NONBLOCK, 1);
+            if (status != APR_SUCCESS) {
+                ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_ERR, status, pool,
+                              "ap_listen_open: unable to make socket non-blocking");
+                return -1;
+            }
+        }
+    }
+#endif /* AP_NONBLOCK_WHEN_MULTI_LISTEN */
+
     /* we come through here on both passes of the open logs phase
      * only register the cleanup once... otherwise we try to close
      * listening sockets twice when cleaning up prior to exec

-- 
albert chin ([EMAIL PROTECTED])

Reply via email to