]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* server/mpm_common.c (dummy_connection): If possible, use a non-SSL
authorJoe Orton <jorton@apache.org>
Fri, 12 Dec 2008 16:08:16 +0000 (16:08 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 12 Dec 2008 16:08:16 +0000 (16:08 +0000)
  listening port to use for the dummy connection, to avoid causing
  (confusing) error log spam by sending EOF down an SSL port.

PR: 39653

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@726065 13f79535-47bb-0310-9956-ffa450edef68

server/mpm_common.c

index f5941f51be213dec84172a39b554ec2e81d1a9c4..72b0e665836ce2d13ab51676d6bb8a432859528c 100644 (file)
@@ -657,6 +657,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
     apr_socket_t *sock;
     apr_pool_t *p;
     apr_size_t len;
+    ap_listen_rec *lp;
 
     /* create a temporary pool for the socket.  pconf stays around too long */
     rv = apr_pool_create(&p, pod->p);
@@ -664,8 +665,19 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
         return rv;
     }
 
-    rv = apr_socket_create(&sock, ap_listeners->bind_addr->family,
-                           SOCK_STREAM, 0, p);
+    /* If possible, find a listener which is configured for
+     * plain-HTTP, not SSL; using an SSL port would either be
+     * expensive to do correctly (performing a complete SSL handshake)
+     * or cause log spam by doing incorrectly (simply sending EOF). */
+    lp = ap_listeners;
+    while (lp && lp->protocol && strcasecmp(lp->protocol, "http") != 0) {
+        lp = lp->next;
+    }
+    if (!lp) {
+        lp = ap_listeners;
+    }
+
+    rv = apr_socket_create(&sock, lp->bind_addr->family, SOCK_STREAM, 0, p);
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
                      "get socket to connect to listener");
@@ -688,7 +700,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
         return rv;
     }
 
-    rv = apr_socket_connect(sock, ap_listeners->bind_addr);
+    rv = apr_socket_connect(sock, lp->bind_addr);
     if (rv != APR_SUCCESS) {
         int log_level = APLOG_WARNING;
 
@@ -701,7 +713,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
         }
 
         ap_log_error(APLOG_MARK, log_level, rv, ap_server_conf,
-                     "connect to listener on %pI", ap_listeners->bind_addr);
+                     "connect to listener on %pI", lp->bind_addr);
     }
 
     /* Create the request string. We include a User-Agent so that