MCPcopy Create free account
hub / github.com/apache/httpd / ap_cache_cacheable_headers

Function ap_cache_cacheable_headers

modules/cache/cache_util.c:1194–1236  ·  view source on GitHub ↗

* Create a new table consisting of those elements from an * headers table that are allowed to be stored in a cache. */

Source from the content-addressed store, hash-verified

1192 * headers table that are allowed to be stored in a cache.
1193 */
1194CACHE_DECLARE(apr_table_t *)ap_cache_cacheable_headers(apr_pool_t *pool,
1195 apr_table_t *t,
1196 server_rec *s)
1197{
1198 cache_server_conf *conf;
1199 char **header;
1200 int i;
1201 apr_table_t *headers_out;
1202
1203 /* Short circuit the common case that there are not
1204 * (yet) any headers populated.
1205 */
1206 if (t == NULL) {
1207 return apr_table_make(pool, 10);
1208 };
1209
1210 /* Make a copy of the headers, and remove from
1211 * the copy any hop-by-hop headers, as defined in Section
1212 * 13.5.1 of RFC 2616
1213 */
1214 headers_out = apr_table_copy(pool, t);
1215
1216 apr_table_unset(headers_out, "Connection");
1217 apr_table_unset(headers_out, "Keep-Alive");
1218 apr_table_unset(headers_out, "Proxy-Authenticate");
1219 apr_table_unset(headers_out, "Proxy-Authorization");
1220 apr_table_unset(headers_out, "TE");
1221 apr_table_unset(headers_out, "Trailers");
1222 apr_table_unset(headers_out, "Transfer-Encoding");
1223 apr_table_unset(headers_out, "Upgrade");
1224
1225 conf = (cache_server_conf *)ap_get_module_config(s->module_config,
1226 &cache_module);
1227
1228 /* Remove the user defined headers set with CacheIgnoreHeaders.
1229 * This may break RFC 2616 compliance on behalf of the administrator.
1230 */
1231 header = (char **)conf->ignore_headers->elts;
1232 for (i = 0; i < conf->ignore_headers->nelts; i++) {
1233 apr_table_unset(headers_out, header[i]);
1234 }
1235 return headers_out;
1236}
1237
1238/*
1239 * Create a new table consisting of those elements from an input

Callers 3

mod_cache.hFile · 0.85

Calls 1

ap_get_module_configFunction · 0.85

Tested by

no test coverage detected