expcov report - Generated Sat Oct 15 21:39:18 2016

 Index  Statistics  Last 
Directory./server
Filenameconnection.c
ModifiedFri Oct 8 08:51:55 2010

Pass Half Fail Excluded Total
Function
0
0.00%
3
100.00%
0
0.00%
3
100%
Expressions
0
0.00%
56
100.00%
0
0.00%
56
100%
Conditions
0
0.00%
0
0.00%
11
100.00%
0
0.00%
11
100%
MC/DC
0
0.00%
6
100.00%
0
0.00%
6
100%
Branches

if
0
0.00%
0
0.00%
8
100.00%
0
0.00%
8
100%
for
0
0.00%
0
0.00%
0
0.00%
0
0.00%
0
100%
while
0
0.00%
0
0.00%
1
100.00%
0
0.00%
1
100%
case
0
0.00%
0
0.00%
0
0.00%
0
0.00%
0
100%

1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements.  See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License.  You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "apr.h"
18#include "apr_strings.h"
19
20#define CORE_PRIVATE
21#include "ap_config.h"
22#include "httpd.h"
23#include "http_connection.h"
24#include "http_request.h"
25#include "http_protocol.h"
26#include "ap_mpm.h"
27#include "mpm_default.h"
28#include "http_config.h"
29#include "http_core.h"
30#include "http_vhost.h"
31#include "scoreboard.h"
32#include "http_log.h"
33#include "util_filter.h"
34
35APR_HOOK_STRUCT(
36            APR_HOOK_LINK(create_connection)
37            APR_HOOK_LINK(process_connection)
38            APR_HOOK_LINK(pre_connection)
39)
40AP_IMPLEMENT_HOOK_RUN_FIRST(conn_rec *,create_connection,
41                            (apr_pool_t *p, server_rec *server, apr_socket_t *csd, long conn_id, void *sbh, apr_bucket_alloc_t *alloc),
42                            (p : server/connection.c line=41 column=42
p
server : server/connection.c line=41 column=57
s
erver, csd : server/connection.c line=41 column=79
c
sd, conn_id : server/connection.c line=41 column=89
c
onn_id, sbh : server/connection.c line=41 column=104
s
bh, alloc : server/connection.c line=41 column=129
a
lloc), NULL)
43AP_IMPLEMENT_HOOK_RUN_FIRST(int,process_connection,(conn_rec *c),(c : server/connection.c line=43 column=63
c
),DECLINED)
44AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec *c, void *csd),(c : server/connection.c line=44 column=57
c
csd : server/connection.c line=44 column=66
c
sd),OK,DECLINED)
45/*
46 * More machine-dependent networking gooo... on some systems,
47 * you've got to be *really* sure that all the packets are acknowledged
48 * before closing the connection, since the client will not be able
49 * to see the last response if their TCP buffer is flushed by a RST
50 * packet from us, which is what the server's TCP stack will send
51 * if it receives any request data after closing the connection.
52 *
53 * In an ideal world, this function would be accomplished by simply
54 * setting the socket option SO_LINGER and handling it within the
55 * server's TCP stack while the process continues on to the next request.
56 * Unfortunately, it seems that most (if not all) operating systems
57 * block the server process on close() when SO_LINGER is used.
58 * For those that don't, see USE_SO_LINGER below.  For the rest,
59 * we have created a home-brew lingering_close.
60 *
61 * Many operating systems tend to block, puke, or otherwise mishandle
62 * calls to shutdown only half of the connection.  You should define
63 * NO_LINGCLOSE in ap_config.h if such is the case for your system.
64 */
65#ifndef MAX_SECS_TO_LINGER
66#define MAX_SECS_TO_LINGER 30
67#endif
68
69AP_CORE_DECLARE(void) ap_flush_conn : call=0
a
p_flush_conn(conn_rec *c)
70{
71    apr_bucket_brigade *bb;
72    apr_bucket *b;
73
74    bb : server/connection.c line=71 column=25
b
= : pass=0
=
 apr_brigade_create : enter=0, leave=0

apr_brigade_create : /usr/include/apr-1/apr_buckets.h line=658 column=35
a
pr_brigade_create(c : server/connection.c line=69 column=47
c
-> : enter=0, leave=0
-
>pool : include/httpd.h line=1047 column=17
p
ool, c : server/connection.c line=69 column=47
c
-> : enter=0, leave=0
-
>bucket_alloc : include/httpd.h line=1103 column=32
b
ucket_alloc);
75
76    /* FLUSH bucket */
77    b : server/connection.c line=72 column=17
b
 = : pass=0
=
 apr_bucket_flush_create : enter=0, leave=0

apr_bucket_flush_create : /usr/include/apr-1/apr_buckets.h line=1278 column=27
a
pr_bucket_flush_create(c : server/connection.c line=69 column=47
c
-> : enter=0, leave=0
-
>bucket_alloc : include/httpd.h line=1103 column=32
b
ucket_alloc);
78    APR_BRIGADE_INSERT_TAIL(bb : server/connection.c line=71 column=25
b
b, b : server/connection.c line=72 column=17
b
);
79
80    /* End Of Connection bucket */
81    b : server/connection.c line=72 column=17
b
 = : pass=0
=
 ap_bucket_eoc_create : enter=0, leave=0

ap_bucket_eoc_create : include/http_connection.h line=143 column=26
a
p_bucket_eoc_create(c : server/connection.c line=69 column=47
c
-> : enter=0, leave=0
-
>bucket_alloc : include/httpd.h line=1103 column=32
b
ucket_alloc);
82    APR_BRIGADE_INSERT_TAIL(bb : server/connection.c line=71 column=25
b
b, b : server/connection.c line=72 column=17
b
);
83
84    ap_pass_brigade : enter=0, leave=0

ap_pass_brigade : include/util_filter.h line=312 column=26
a
p_pass_brigade(c : server/connection.c line=69 column=47
c
-> : enter=0, leave=0
-
>output_filters : include/httpd.h line=1099 column=25
o
utput_filters, bb : server/connection.c line=71 column=25
b
b);
85}
86
87/* we now proceed to read from the client until we get EOF, or until
88 * MAX_SECS_TO_LINGER has passed.  the reasons for doing this are
89 * documented in a draft:
90 *
91 * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
92 *
93 * in a nutshell -- if we don't make this effort we risk causing
94 * TCP RST packets to be sent which can tear down a connection before
95 * all the response data has been sent to the client.
96 */
97#define SECONDS_TO_LINGER  2
98AP_DECLARE(void) ap_lingering_close : call=0
a
p_lingering_close(conn_rec *c)
99{
100    char dummybuf[512];
101    apr_size_t nbytes;
102    apr_time_t timeup = 0;
103    apr_socket_t *csd = ap_get_module_config(c : server/connection.c line=98 column=47
c
-> : enter=0, leave=0
-
>conn_config : include/httpd.h line=1092 column=30
c
onn_config, &core_module : include/http_core.h line=345 column=31
c
ore_module);
104
105    if : true=0, false=0
i
f (! : true=0, false=0
!
csd : server/connection.c line=103 column=19
c
sd) {
106        return : pass=0
r
eturn;
107    }
108
109    ap_update_child_status : enter=0, leave=0

ap_update_child_status : include/scoreboard.h line=187 column=17
a
p_update_child_status(c : server/connection.c line=98 column=47
c
-> : enter=0, leave=0
-
>sbh : include/httpd.h line=1101 column=11
s
bh, SERVER_CLOSING, NULL);
110
111#ifdef NO_LINGCLOSE
112    ap_flush_conn(c); /* just close it */
113    apr_socket_close(csd);
114    return;
115#endif
116
117    /* Close the connection, being careful to send out whatever is still
118     * in our buffers.  If possible, try to avoid a hard close until the
119     * client has ACKed our FIN and/or has stopped sending us data.
120     */
121
122    /* Send any leftover data to the client, but never try to again */
123    ap_flush_conn : enter=0, leave=0

ap_flush_conn : server/connection.c line=69 column=23
a
p_flush_conn(c : server/connection.c line=98 column=47
c
);
124
125    if : true=0, false=0
i
f (c : server/connection.c line=98 column=47
c
-> : enter=0, leave=0
-
>aborted : include/httpd.h line=1070 column=14
a
borted) {
126        apr_socket_close : enter=0, leave=0

apr_socket_close : /usr/include/apr-1/apr_network_io.h line=307 column=27
a
pr_socket_close(csd : server/connection.c line=103 column=19
c
sd);
127        return : pass=0
r
eturn;
128    }
129
130    /* Shut down the socket for write, which will send a FIN
131     * to the peer.
132     */
133    if : true=0, false=0
i
f (apr_socket_shutdown : enter=0, leave=0

apr_socket_shutdown : /usr/include/apr-1/apr_network_io.h line=300 column=27
a
pr_socket_shutdown(csd : server/connection.c line=103 column=19
c
sd, APR_SHUTDOWN_WRITE : /usr/include/apr-1/apr_network_io.h line=108 column=5 APR_SHUTDOWN_WRITE) != : true=0, false=0
MC/DC independently affect : true=0, false=0
!TF
= APR_SUCCESS
134        || : true=0, false=0
|
c : server/connection.c line=98 column=47
c
MC/DC independently affect : true=0, false=0
-> : enter=0, leave=0
-TF
>aborted : include/httpd.h line=1070 column=14
a
borted) {
135        apr_socket_close : enter=0, leave=0

apr_socket_close : /usr/include/apr-1/apr_network_io.h line=307 column=27
a
pr_socket_close(csd : server/connection.c line=103 column=19
c
sd);
136        return : pass=0
r
eturn;
137    }
138
139    /* Read available data from the client whilst it continues sending
140     * it, for a maximum time of MAX_SECS_TO_LINGER.  If the client
141     * does not send any data within 2 seconds (a value pulled from
142     * Apache 1.3 which seems to work well), give up.
143     */
144    apr_socket_timeout_set : enter=0, leave=0

apr_socket_timeout_set : /usr/include/apr-1/apr_network_io.h line=614 column=27
a
pr_socket_timeout_set(csd : server/connection.c line=103 column=19
c
sd, apr_time_from_sec(SECONDS_TO_LINGER));
145    apr_socket_opt_set : enter=0, leave=0

apr_socket_opt_set : /usr/include/apr-1/apr_network_io.h line=600 column=27
a
pr_socket_opt_set(csd : server/connection.c line=103 column=19
c
sd, APR_INCOMPLETE_READ, 1);
146
147    /* The common path here is that the initial apr_socket_recv() call
148     * will return 0 bytes read; so that case must avoid the expensive
149     * apr_time_now() call and time arithmetic. */
150
151    do {
152        nbytes : server/connection.c line=101 column=16
n
bytes = : pass=0
=
 sizeof(dummybuf);
153        if : true=0, false=0
i
f (MC/DC independently affect : true=0, false=0
apr_socket_recv : enter=0, leave=0

apr_socket_recv : /usr/include/apr-1/apr_network_io.h line=575 column=27
aTF
pr_socket_recv(csd : server/connection.c line=103 column=19
c
sd, dummybuf : server/connection.c line=100 column=10
d
ummybuf, &nbytes : server/connection.c line=101 column=16
n
bytes) || : true=0, false=0
|
nbytes : server/connection.c line=101 column=16
n
bytes == : true=0, false=0
MC/DC independently affect : true=0, false=0
=TF
= 0)
154            break : pass=0
b
reak;
155
156        if : true=0, false=0
i
f (timeup : server/connection.c line=102 column=16
t
imeup == : true=0, false=0
=
= 0) {
157            /*
158             * First time through;
159             * calculate now + 30 seconds (MAX_SECS_TO_LINGER).
160             *
161             * If some module requested a shortened waiting period, only wait
162             * for 2s (SECONDS_TO_LINGER). This is useful for mitigating
163             * certain DoS attacks.
164             */
165            if : true=0, false=0
i
f (apr_table_get : enter=0, leave=0

apr_table_get : /usr/include/apr-1/apr_tables.h line=258 column=27
a
pr_table_get(c : server/connection.c line=98 column=47
c
-> : enter=0, leave=0
-
>notes : include/httpd.h line=1095 column=18
n
otes, "short-lingering-close")) {
166                timeup : server/connection.c line=102 column=16
t
imeup = : pass=0
=
 apr_time_now : enter=0, leave=0

apr_time_now : /usr/include/apr-1/apr_time.h line=85 column=25
a
pr_time_now() + : pass=0
+
 apr_time_from_sec(SECONDS_TO_LINGER);
167            }
168            else {
169                timeup : server/connection.c line=102 column=16
t
imeup = : pass=0
=
 apr_time_now : enter=0, leave=0

apr_time_now : /usr/include/apr-1/apr_time.h line=85 column=25
a
pr_time_now() + : pass=0
+
 apr_time_from_sec(MAX_SECS_TO_LINGER);
170            }
171            continue : pass=0
c
ontinue;
172        }
173    } while : true=0, false=0
w
hile (apr_time_now : enter=0, leave=0

apr_time_now : /usr/include/apr-1/apr_time.h line=85 column=25
a
pr_time_now() < : true=0, false=0
<
 timeup : server/connection.c line=102 column=16
t
imeup);
174
175    apr_socket_close : enter=0, leave=0

apr_socket_close : /usr/include/apr-1/apr_network_io.h line=307 column=27
a
pr_socket_close(csd : server/connection.c line=103 column=19
c
sd);
176    return : pass=0
r
eturn;
177}
178
179AP_CORE_DECLARE(void) ap_process_connection : call=0
a
p_process_connection(conn_rec *c, void *csd)
180{
181    int rc;
182    ap_update_vhost_given_ip : enter=0, leave=0

ap_update_vhost_given_ip : include/http_vhost.h line=92 column=18
a
p_update_vhost_given_ip(c : server/connection.c line=179 column=55
c
);
183
184    rc : server/connection.c line=181 column=9
r
= : pass=0
=
 ap_run_pre_connection : enter=0, leave=0

ap_run_pre_connection : server/ line=13 column=1
a
p_run_pre_connection(c : server/connection.c line=179 column=55
c
csd : server/connection.c line=179 column=64
c
sd);
185    if : true=0, false=0
i
f (rc : server/connection.c line=181 column=9
r
!= : true=0, false=0
MC/DC independently affect : true=0, false=0
!TF
= OK && : true=0, false=0
&
rc : server/connection.c line=181 column=9
r
!= : true=0, false=0
MC/DC independently affect : true=0, false=0
!TF
= DONE) {
186        c : server/connection.c line=179 column=55
c
-> : enter=0, leave=0
-
>aborted : include/httpd.h line=1070 column=14
a
borted = : enter=0, leave=0
=
 1;
187    }
188
189    if : true=0, false=0
i
f (! : true=0, false=0
!
c : server/connection.c line=179 column=55
c
-> : enter=0, leave=0
-
>aborted : include/httpd.h line=1070 column=14
a
borted) {
190        ap_run_process_connection : enter=0, leave=0

ap_run_process_connection : server/ line=157 column=1
a
p_run_process_connection(c : server/connection.c line=179 column=55
c
);
191    }
192}
193
194[EOF]


Generated by expcov