]>
Commit | Line | Data |
---|---|---|
a0dc379f AM |
1 | commit baf08a26b4e3f40491ae9459ef80a7460194c064 |
2 | Author: jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | |
3 | Date: Fri Dec 12 16:08:16 2008 +0000 | |
4 | ||
5 | * server/mpm_common.c (dummy_connection): If possible, use a non-SSL | |
6 | listening port to use for the dummy connection, to avoid causing | |
7 | (confusing) error log spam by sending EOF down an SSL port. | |
8 | ||
9 | PR: 39653 | |
10 | ||
11 | ||
12 | git-svn-id: http://svn.apache.org/repos/asf/httpd/httpd/trunk@726065 13f79535-47bb-0310-9956-ffa450edef68 | |
13 | ||
14 | diff --git a/server/mpm_common.c b/server/mpm_common.c | |
15 | index f5941f5..72b0e66 100644 | |
16 | --- a/server/mpm_common.c | |
17 | +++ b/server/mpm_common.c | |
18 | @@ -657,6 +657,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod) | |
19 | apr_socket_t *sock; | |
20 | apr_pool_t *p; | |
21 | apr_size_t len; | |
22 | + ap_listen_rec *lp; | |
23 | ||
24 | /* create a temporary pool for the socket. pconf stays around too long */ | |
25 | rv = apr_pool_create(&p, pod->p); | |
26 | @@ -664,8 +665,19 @@ static apr_status_t dummy_connection(ap_pod_t *pod) | |
27 | return rv; | |
28 | } | |
29 | ||
30 | - rv = apr_socket_create(&sock, ap_listeners->bind_addr->family, | |
31 | - SOCK_STREAM, 0, p); | |
32 | + /* If possible, find a listener which is configured for | |
33 | + * plain-HTTP, not SSL; using an SSL port would either be | |
34 | + * expensive to do correctly (performing a complete SSL handshake) | |
35 | + * or cause log spam by doing incorrectly (simply sending EOF). */ | |
36 | + lp = ap_listeners; | |
37 | + while (lp && lp->protocol && strcasecmp(lp->protocol, "http") != 0) { | |
38 | + lp = lp->next; | |
39 | + } | |
40 | + if (!lp) { | |
41 | + lp = ap_listeners; | |
42 | + } | |
43 | + | |
44 | + rv = apr_socket_create(&sock, lp->bind_addr->family, SOCK_STREAM, 0, p); | |
45 | if (rv != APR_SUCCESS) { | |
46 | ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, | |
47 | "get socket to connect to listener"); | |
48 | @@ -688,7 +700,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod) | |
49 | return rv; | |
50 | } | |
51 | ||
52 | - rv = apr_socket_connect(sock, ap_listeners->bind_addr); | |
53 | + rv = apr_socket_connect(sock, lp->bind_addr); | |
54 | if (rv != APR_SUCCESS) { | |
55 | int log_level = APLOG_WARNING; | |
56 | ||
57 | @@ -704,7 +704,7 @@ static apr_status_t dummy_connection(ap_ | |
58 | } | |
59 | ||
60 | ap_log_error(APLOG_MARK, log_level, rv, ap_server_conf, | |
61 | - "connect to listener on %pI", ap_listeners->bind_addr); | |
62 | + "connect to listener on %pI", lp->bind_addr); | |
63 | apr_pool_destroy(p); | |
64 | return rv; | |
65 | } | |
66 | ||
6b0efdb8 AM |
67 | @@ -709,7 +709,7 @@ static apr_status_t dummy_connection(ap_ |
68 | return rv; | |
69 | } | |
70 | ||
71 | - if (ap_listeners->protocol && strcasecmp(ap_listeners->protocol, "https") == 0) { | |
72 | + if (lp->protocol && strcasecmp(lp->protocol, "https") == 0) { | |
73 | /* Send a TLS 1.0 close_notify alert. This is perhaps the | |
74 | * "least wrong" way to open and cleanly terminate an SSL | |
75 | * connection. It should "work" without noisy error logs if |