MCPcopy Index your code
hub / github.com/apache/httpd / cache_accept_headers

Function cache_accept_headers

modules/cache/cache_storage.c:161–201  ·  view source on GitHub ↗

* Take two sets of headers, sandwich them together, and apply the result to * r->headers_out. * * To complicate this, a header may be duplicated in either table. Should a * header exist in the top table, all matching headers will be removed from * the bottom table before the headers are combined. The Warning headers are * handled specially. Warnings are added rather than being replaced, whil

Source from the content-addressed store, hash-verified

159 * into the request.
160 */
161void cache_accept_headers(cache_handle_t *h, request_rec *r, apr_table_t *top,
162 apr_table_t *bottom, int revalidation)
163{
164 const char *v;
165
166 if (revalidation) {
167 r->headers_out = apr_table_make(r->pool, 10);
168 apr_table_do(filter_header_do, r->headers_out, bottom, NULL);
169 }
170 else if (r->headers_out != bottom) {
171 r->headers_out = apr_table_copy(r->pool, bottom);
172 }
173 apr_table_do(remove_header_do, r->headers_out, top, NULL);
174 apr_table_do(add_header_do, r->headers_out, top, NULL);
175
176 v = apr_table_get(r->headers_out, "Content-Type");
177 if (v) {
178 ap_set_content_type(r, v);
179 /*
180 * Also unset possible Content-Type headers in r->headers_out and
181 * r->err_headers_out as they may be different to what we have received
182 * from the cache.
183 * Actually they are not needed as r->content_type set by
184 * ap_set_content_type above will be used in the store_headers functions
185 * of the storage providers as a fallback and the HTTP_HEADER filter
186 * does overwrite the Content-Type header with r->content_type anyway.
187 */
188 apr_table_unset(r->headers_out, "Content-Type");
189 apr_table_unset(r->err_headers_out, "Content-Type");
190 }
191
192 /* If the cache gave us a Last-Modified header, we can't just
193 * pass it on blindly because of restrictions on future values.
194 */
195 v = apr_table_get(r->headers_out, "Last-Modified");
196 if (v) {
197 ap_update_mtime(r, apr_date_parse_http(v));
198 ap_set_last_modified(r);
199 }
200
201}
202
203/*
204 * select a specific URL entity in the cache

Callers 2

cache_selectFunction · 0.85
cache_save_filterFunction · 0.85

Calls 3

ap_set_content_typeFunction · 0.85
ap_update_mtimeFunction · 0.85
ap_set_last_modifiedFunction · 0.85

Tested by

no test coverage detected