summaryrefslogtreecommitdiff
path: root/modules/cache/mod_disk_cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/cache/mod_disk_cache.c')
-rw-r--r--modules/cache/mod_disk_cache.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/modules/cache/mod_disk_cache.c b/modules/cache/mod_disk_cache.c
index 4148b373..70a804b8 100644
--- a/modules/cache/mod_disk_cache.c
+++ b/modules/cache/mod_disk_cache.c
@@ -357,6 +357,10 @@ static int open_entity(cache_handle_t *h, request_rec *r, const char *key)
static int error_logged = 0;
disk_cache_conf *conf = ap_get_module_config(r->server->module_config,
&disk_cache_module);
+#ifdef APR_SENDFILE_ENABLED
+ core_dir_config *coreconf = ap_get_module_config(r->per_dir_config,
+ &core_module);
+#endif
apr_finfo_t finfo;
cache_object_t *obj;
cache_info *info;
@@ -452,7 +456,12 @@ static int open_entity(cache_handle_t *h, request_rec *r, const char *key)
/* Open the data file */
flags = APR_READ|APR_BINARY;
#ifdef APR_SENDFILE_ENABLED
- flags |= APR_SENDFILE_ENABLED;
+ /* When we are in the quick handler we don't have the per-directory
+ * configuration, so this check only takes the globel setting of
+ * the EnableSendFile directive into account.
+ */
+ flags |= ((coreconf->enable_sendfile == ENABLE_SENDFILE_OFF)
+ ? 0 : APR_SENDFILE_ENABLED);
#endif
rc = apr_file_open(&dobj->fd, dobj->datafile, flags, 0, r->pool);
if (rc != APR_SUCCESS) {
@@ -907,7 +916,9 @@ static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info
if (r->headers_out) {
apr_table_t *headers_out;
- headers_out = ap_cache_cacheable_hdrs_out(r->pool, r->headers_out,
+ headers_out = apr_table_overlay(r->pool, r->headers_out,
+ r->err_headers_out);
+ headers_out = ap_cache_cacheable_hdrs_out(r->pool, headers_out,
r->server);
if (!apr_table_get(headers_out, "Content-Type")
@@ -916,8 +927,12 @@ static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info
ap_make_content_type(r, r->content_type));
}
- headers_out = apr_table_overlay(r->pool, headers_out,
- r->err_headers_out);
+ if (!apr_table_get(headers_out, "Content-Encoding")
+ && r->content_encoding) {
+ apr_table_setn(headers_out, "Content-Encoding",
+ r->content_encoding);
+ }
+
rv = store_table(dobj->hfd, headers_out);
if (rv != APR_SUCCESS) {
return rv;