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

 Index  Statistics  Last 
Directory./modules/http
Filenamehttp_etag.c
ModifiedTue Dec 18 12:46:48 2007

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

if
0
0.00%
0
0.00%
17
100.00%
0
0.00%
17
100%
for
0
0.00%
0
0.00%
0
0.00%
0
0.00%
0
100%
while
0
0.00%
0
0.00%
3
100.00%
0
0.00%
3
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_strings.h"
18#include "apr_thread_proc.h"    /* for RLIMIT stuff */
19
20#define APR_WANT_STRFUNC
21#include "apr_want.h"
22
23#define CORE_PRIVATE
24#include "httpd.h"
25#include "http_config.h"
26#include "http_connection.h"
27#include "http_core.h"
28#include "http_protocol.h"   /* For index_of_response().  Grump. */
29#include "http_request.h"
30
31/* Generate the human-readable hex representation of an apr_uint64_t
32 * (basically a faster version of 'sprintf("%llx")')
33 */
34#define HEX_DIGITS "0123456789abcdef"
35static char *etag_uint64_to_hex : call=0
e
tag_uint64_to_hex(char *next, apr_uint64_t u)
36{
37    int printing = 0;
38    int shift = sizeof(apr_uint64_t) * : pass=0
*
 8 - : pass=0
-
 4;
39    do {
40        unsigned short next_digit = (unsigned short)
41                                    ((u : modules/http/http_etag.c line=35 column=58
u
 >> : pass=0
>
shift : modules/http/http_etag.c line=38 column=9
s
hift) & : pass=0
&
 (apr_uint64_t)0xf);
42        if : true=0, false=0
i
f (next_digit : modules/http/http_etag.c line=40 column=24
n
ext_digit) {
43            *next : modules/http/http_etag.c line=35 column=39
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 HEX_DIGITS[] : enter=0, leave=0
[
next_digit : modules/http/http_etag.c line=40 column=24
n
ext_digit];
44            printing : modules/http/http_etag.c line=37 column=9
p
rinting = : pass=0
=
 1;
45        }
46        else if : true=0, false=0
i
f (printing : modules/http/http_etag.c line=37 column=9
p
rinting) {
47            *next : modules/http/http_etag.c line=35 column=39
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 HEX_DIGITS[] : enter=0, leave=0
[
next_digit : modules/http/http_etag.c line=40 column=24
n
ext_digit];
48        }
49        shift : modules/http/http_etag.c line=38 column=9
s
hift -= : pass=0
-
= 4;
50    } while : true=0, false=0
w
hile (shift : modules/http/http_etag.c line=38 column=9
s
hift);
51    *next : modules/http/http_etag.c line=35 column=39
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 HEX_DIGITS[] : enter=0, leave=0
[
u : modules/http/http_etag.c line=35 column=58
u
 & : pass=0
&
 (apr_uint64_t)0xf];
52    return : pass=0
r
eturn next : modules/http/http_etag.c line=35 column=39
n
ext;
53}
54
55#define ETAG_WEAK "W/"
56#define CHARS_PER_UINT64 (sizeof(apr_uint64_t) * : pass=0
*
 2)
57/*
58 * Construct an entity tag (ETag) from resource information.  If it's a real
59 * file, build in some of the file characteristics.  If the modification time
60 * is newer than (request-time minus 1 second), mark the ETag as weak - it
61 * could be modified again in as short an interval.  We rationalize the
62 * modification time we're given to keep it from being in the future.
63 */
64AP_DECLARE(char *) ap_make_etag : call=0
a
p_make_etag(request_rec *r, int force_weak)
65{
66    char *weak;
67    apr_size_t weak_len;
68    char *etag;
69    char *next;
70    core_dir_config *cfg;
71    etag_components_t etag_bits;
72    etag_components_t bits_added;
73
74    cfg : modules/http/http_etag.c line=70 column=22
c
fg = : pass=0
=
 (core_dir_config *)ap_get_module_config(r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>per_dir_config : include/httpd.h line=977 column=30
p
er_dir_config,
75                                                  &core_module : include/http_core.h line=345 column=31
c
ore_module);
76    etag_bits : modules/http/http_etag.c line=71 column=23
e
tag_bits = : pass=0
=
 (cfg : modules/http/http_etag.c line=70 column=22
c
fg-> : enter=0, leave=0
-
>etag_bits : include/http_core.h line=556 column=23
e
tag_bits & : pass=0
&
 (~ : pass=0
~
 cfg : modules/http/http_etag.c line=70 column=22
c
fg-> : enter=0, leave=0
-
>etag_remove : include/http_core.h line=558 column=23
e
tag_remove)) | : pass=0
|
 cfg : modules/http/http_etag.c line=70 column=22
c
fg-> : enter=0, leave=0
-
>etag_add : include/http_core.h line=557 column=23
e
tag_add;
77
78    /*
79     * If it's a file (or we wouldn't be here) and no ETags
80     * should be set for files, return an empty string and
81     * note it for the header-sender to ignore.
82     */
83    if : true=0, false=0
i
f (etag_bits : modules/http/http_etag.c line=71 column=23
e
tag_bits & : pass=0
&
 ETAG_NONE) {
84        apr_table_setn : enter=0, leave=0

apr_table_setn : /usr/include/apr-1/apr_tables.h line=282 column=19
a
pr_table_setn(r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>notes : include/httpd.h line=910 column=18
n
otes, "no-etag", "omit");
85        return : pass=0
r
eturn "";
86    }
87
88    if : true=0, false=0
i
f (etag_bits : modules/http/http_etag.c line=71 column=23
e
tag_bits == : true=0, false=0
=
= ETAG_UNSET) {
89        etag_bits : modules/http/http_etag.c line=71 column=23
e
tag_bits = : pass=0
=
 ETAG_BACKWARD;
90    }
91    /*
92     * Make an ETag header out of various pieces of information. We use
93     * the last-modified date and, if we have a real file, the
94     * length and inode number - note that this doesn't have to match
95     * the content-length (i.e. includes), it just has to be unique
96     * for the file.
97     *
98     * If the request was made within a second of the last-modified date,
99     * we send a weak tag instead of a strong one, since it could
100     * be modified again later in the second, and the validation
101     * would be incorrect.
102     */
103    if : true=0, false=0
i
f ((r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>request_time : include/httpd.h line=817 column=16
r
equest_time - : pass=0
-
 r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>mtime : include/httpd.h line=864 column=16
m
time > : true=0, false=0
MC/DC independently affect : true=0, false=0
>TF
 (1 * : pass=0
*
 APR_USEC_PER_SEC)) && : true=0, false=0
&
&
104        ! : true=0, false=0
MC/DC independently affect : true=0, false=0
!TF
force_weak : modules/http/http_etag.c line=64 column=53
f
orce_weak) {
105        weak : modules/http/http_etag.c line=66 column=11
w
eak = : pass=0
=
 NULL;
106        weak_len : modules/http/http_etag.c line=67 column=16
w
eak_len = : pass=0
=
 0;
107    }
108    else {
109        weak : modules/http/http_etag.c line=66 column=11
w
eak = : pass=0
=
 ETAG_WEAK;
110        weak_len : modules/http/http_etag.c line=67 column=16
w
eak_len = : pass=0
=
 sizeof(ETAG_WEAK);
111    }
112
113    if : true=0, false=0
i
f (r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>finfo : include/httpd.h line=957 column=17
f
info.filetype : /usr/include/apr-1/apr_file_info.h line=186 column=20 filetype != : true=0, false=0
!
= 0) {
114        /*
115         * ETag gets set to [W/]"inode-size-mtime", modulo any
116         * FileETag keywords.
117         */
118        etag : modules/http/http_etag.c line=68 column=11
e
tag = : pass=0
=
 apr_palloc : enter=0, leave=0

apr_palloc : /usr/include/apr-1/apr_pools.h line=419 column=21
a
pr_palloc(r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>pool : include/httpd.h line=780 column=17
p
ool, weak_len : modules/http/http_etag.c line=67 column=16
w
eak_len + : pass=0
+
 sizeof("\"--\"") + : pass=0
+
119                          3 * : pass=0
*
 CHARS_PER_UINT64 + : pass=0
+
 1);
120        next : modules/http/http_etag.c line=69 column=11
n
ext = : pass=0
=
 etag : modules/http/http_etag.c line=68 column=11
e
tag;
121        if : true=0, false=0
i
f (weak : modules/http/http_etag.c line=66 column=11
w
eak) {
122            while : true=0, false=0
w
hile (* dereference : enter=0, leave=0
*
weak : modules/http/http_etag.c line=66 column=11
w
eak) {
123                *next : modules/http/http_etag.c line=69 column=11
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 * dereference : enter=0, leave=0
*
weak : modules/http/http_etag.c line=66 column=11
w
eak++ : pass=0
+
+;
124            }
125        }
126        *next : modules/http/http_etag.c line=69 column=11
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 '"';
127        bits_added : modules/http/http_etag.c line=72 column=23
b
its_added = : pass=0
=
 0;
128        if : true=0, false=0
i
f (etag_bits : modules/http/http_etag.c line=71 column=23
e
tag_bits & : pass=0
&
 ETAG_INODE) {
129            next : modules/http/http_etag.c line=69 column=11
n
ext = : pass=0
=
 etag_uint64_to_hex : enter=0, leave=0

etag_uint64_to_hex : modules/http/http_etag.c line=35 column=14
e
tag_uint64_to_hex(next : modules/http/http_etag.c line=69 column=11
n
ext, r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>finfo : include/httpd.h line=957 column=17
f
info.inode : /usr/include/apr-1/apr_file_info.h line=192 column=15 inode);
130            bits_added : modules/http/http_etag.c line=72 column=23
b
its_added |= : pass=0
|
= ETAG_INODE;
131        }
132        if : true=0, false=0
i
f (etag_bits : modules/http/http_etag.c line=71 column=23
e
tag_bits & : pass=0
&
 ETAG_SIZE) {
133            if : true=0, false=0
i
f (bits_added : modules/http/http_etag.c line=72 column=23
b
its_added != : true=0, false=0
!
= 0) {
134                *next : modules/http/http_etag.c line=69 column=11
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 '-';
135            }
136            next : modules/http/http_etag.c line=69 column=11
n
ext = : pass=0
=
 etag_uint64_to_hex : enter=0, leave=0

etag_uint64_to_hex : modules/http/http_etag.c line=35 column=14
e
tag_uint64_to_hex(next : modules/http/http_etag.c line=69 column=11
n
ext, r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>finfo : include/httpd.h line=957 column=17
f
info.size : /usr/include/apr-1/apr_file_info.h line=198 column=15 size);
137            bits_added : modules/http/http_etag.c line=72 column=23
b
its_added |= : pass=0
|
= ETAG_SIZE;
138        }
139        if : true=0, false=0
i
f (etag_bits : modules/http/http_etag.c line=71 column=23
e
tag_bits & : pass=0
&
 ETAG_MTIME) {
140            if : true=0, false=0
i
f (bits_added : modules/http/http_etag.c line=72 column=23
b
its_added != : true=0, false=0
!
= 0) {
141                *next : modules/http/http_etag.c line=69 column=11
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 '-';
142            }
143            next : modules/http/http_etag.c line=69 column=11
n
ext = : pass=0
=
 etag_uint64_to_hex : enter=0, leave=0

etag_uint64_to_hex : modules/http/http_etag.c line=35 column=14
e
tag_uint64_to_hex(next : modules/http/http_etag.c line=69 column=11
n
ext, r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>mtime : include/httpd.h line=864 column=16
m
time);
144        }
145        *next : modules/http/http_etag.c line=69 column=11
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 '"';
146        *next : modules/http/http_etag.c line=69 column=11
n
ext = : enter=0, leave=0
=
 '\0';
147    }
148    else {
149        /*
150         * Not a file document, so just use the mtime: [W/]"mtime"
151         */
152        etag : modules/http/http_etag.c line=68 column=11
e
tag = : pass=0
=
 apr_palloc : enter=0, leave=0

apr_palloc : /usr/include/apr-1/apr_pools.h line=419 column=21
a
pr_palloc(r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>pool : include/httpd.h line=780 column=17
p
ool, weak_len : modules/http/http_etag.c line=67 column=16
w
eak_len + : pass=0
+
 sizeof("\"\"") + : pass=0
+
153                          CHARS_PER_UINT64 + : pass=0
+
 1);
154        next : modules/http/http_etag.c line=69 column=11
n
ext = : pass=0
=
 etag : modules/http/http_etag.c line=68 column=11
e
tag;
155        if : true=0, false=0
i
f (weak : modules/http/http_etag.c line=66 column=11
w
eak) {
156            while : true=0, false=0
w
hile (* dereference : enter=0, leave=0
*
weak : modules/http/http_etag.c line=66 column=11
w
eak) {
157                *next : modules/http/http_etag.c line=69 column=11
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 * dereference : enter=0, leave=0
*
weak : modules/http/http_etag.c line=66 column=11
w
eak++ : pass=0
+
+;
158            }
159        }
160        *next : modules/http/http_etag.c line=69 column=11
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 '"';
161        next : modules/http/http_etag.c line=69 column=11
n
ext = : pass=0
=
 etag_uint64_to_hex : enter=0, leave=0

etag_uint64_to_hex : modules/http/http_etag.c line=35 column=14
e
tag_uint64_to_hex(next : modules/http/http_etag.c line=69 column=11
n
ext, r : modules/http/http_etag.c line=64 column=46
r
-> : enter=0, leave=0
-
>mtime : include/httpd.h line=864 column=16
m
time);
162        *next : modules/http/http_etag.c line=69 column=11
n
ext++ : pass=0
+
= : enter=0, leave=0
=
 '"';
163        *next : modules/http/http_etag.c line=69 column=11
n
ext = : enter=0, leave=0
=
 '\0';
164    }
165
166    return : pass=0
r
eturn etag : modules/http/http_etag.c line=68 column=11
e
tag;
167}
168
169AP_DECLARE(void) ap_set_etag : call=0
a
p_set_etag(request_rec *r)
170{
171    char *etag;
172    char *variant_etag, *vlv;
173    int vlv_weak;
174
175    if : true=0, false=0
i
f (! : true=0, false=0
!
r : modules/http/http_etag.c line=169 column=43
r
-> : enter=0, leave=0
-
>vlist_validator : include/httpd.h line=927 column=11
v
list_validator) {
176        etag : modules/http/http_etag.c line=171 column=11
e
tag = : pass=0
=
 ap_make_etag : enter=0, leave=0

ap_make_etag : modules/http/http_etag.c line=64 column=20
a
p_make_etag(r : modules/http/http_etag.c line=169 column=43
r
, 0);
177
178        /* If we get a blank etag back, don't set the header. */
179        if : true=0, false=0
i
f (! : true=0, false=0
!
etag : modules/http/http_etag.c line=171 column=11
e
tag[] : enter=0, leave=0
[
0]) {
180            return : pass=0
r
eturn;
181        }
182    }
183    else {
184        /* If we have a variant list validator (vlv) due to the
185         * response being negotiated, then we create a structured
186         * entity tag which merges the variant etag with the variant
187         * list validator (vlv).  This merging makes revalidation
188         * somewhat safer, ensures that caches which can deal with
189         * Vary will (eventually) be updated if the set of variants is
190         * changed, and is also a protocol requirement for transparent
191         * content negotiation.
192         */
193
194        /* if the variant list validator is weak, we make the whole
195         * structured etag weak.  If we would not, then clients could
196         * have problems merging range responses if we have different
197         * variants with the same non-globally-unique strong etag.
198         */
199
200        vlv : modules/http/http_etag.c line=172 column=26
v
lv = : pass=0
=
 r : modules/http/http_etag.c line=169 column=43
r
-> : enter=0, leave=0
-
>vlist_validator : include/httpd.h line=927 column=11
v
list_validator;
201        vlv_weak : modules/http/http_etag.c line=173 column=9
v
lv_weak = : pass=0
=
 (vlv : modules/http/http_etag.c line=172 column=26
v
lv[] : enter=0, leave=0
[
0] == : true=0, false=0
=
= 'W');
202
203        variant_etag : modules/http/http_etag.c line=172 column=11
v
ariant_etag = : pass=0
=
 ap_make_etag : enter=0, leave=0

ap_make_etag : modules/http/http_etag.c line=64 column=20
a
p_make_etag(r : modules/http/http_etag.c line=169 column=43
r
vlv_weak : modules/http/http_etag.c line=173 column=9
v
lv_weak);
204
205        /* If we get a blank etag back, don't append vlv and stop now. */
206        if : true=0, false=0
i
f (! : true=0, false=0
!
variant_etag : modules/http/http_etag.c line=172 column=11
v
ariant_etag[] : enter=0, leave=0
[
0]) {
207            return : pass=0
r
eturn;
208        }
209
210        /* merge variant_etag and vlv into a structured etag */
211        variant_etag : modules/http/http_etag.c line=172 column=11
v
ariant_etag[strlen : enter=0, leave=0

strlen : /usr/include/string.h line=399 column=15
s
trlen(variant_etag : modules/http/http_etag.c line=172 column=11
v
ariant_etag) - : pass=0
-
 1] = : enter=0, leave=0
=
 '\0';
212        if : true=0, false=0
i
f (vlv_weak : modules/http/http_etag.c line=173 column=9
v
lv_weak) {
213            vlv : modules/http/http_etag.c line=172 column=26
v
lv += : pass=0
+
= 3;
214        }
215        else {
216            vlv : modules/http/http_etag.c line=172 column=26
v
lv++ : pass=0
+
+;
217        }
218        etag : modules/http/http_etag.c line=171 column=11
e
tag = : pass=0
=
 apr_pstrcat : enter=0, leave=0

apr_pstrcat : /usr/include/apr-1/apr_strings.h line=139 column=28
a
pr_pstrcat(r : modules/http/http_etag.c line=169 column=43
r
-> : enter=0, leave=0
-
>pool : include/httpd.h line=780 column=17
p
ool, variant_etag : modules/http/http_etag.c line=172 column=11
v
ariant_etag, ";", vlv : modules/http/http_etag.c line=172 column=26
v
lv, NULL);
219    }
220
221    apr_table_setn : enter=0, leave=0

apr_table_setn : /usr/include/apr-1/apr_tables.h line=282 column=19
a
pr_table_setn(r : modules/http/http_etag.c line=169 column=43
r
-> : enter=0, leave=0
-
>headers_out : include/httpd.h line=903 column=18
h
eaders_out, "ETag", etag : modules/http/http_etag.c line=171 column=11
e
tag);
222}
223[EOF]


Generated by expcov