From: Lars Eilebrecht
Date: Sat, 21 Feb 2009 17:38:33 +0000 (+0000)
Subject: mod_disk_cache now turns off sendfile support if 'EnableSendfile off'
X-Git-Tag: 2.2.12~206
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0790fb1e72dc8d00860fa454c1eabecf3c52ef7;p=thirdparty%2Fapache%2Fhttpd.git
mod_disk_cache now turns off sendfile support if 'EnableSendfile off'
is defined globally.
Reviewed by: Ruediger Pluem, Issac Goldstand, Niklas Edmundsson
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@746552 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/CHANGES b/CHANGES
index 0e6c6796933..be07d0b61f2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes with Apache 2.2.12
+ *) mod_disk_cache: The module now turns off sendfile support if
+ 'EnableSendfile off' is defined globally. PR 41218.
+ [Lars Eilebrecht, Issac Goldstand]
+
*) prefork: Fix child process hang during graceful restart/stop in
configurations with multiple listening sockets. PR 42829. [Joe Orton,
Jeff Trawick]
diff --git a/docs/manual/mod/core.html.de b/docs/manual/mod/core.html.de
index 0fe9e2343d7..b36e08274b0 100644
--- a/docs/manual/mod/core.html.de
+++ b/docs/manual/mod/core.html.de
@@ -978,6 +978,12 @@ Dateien an den Client auszuliefern
</Directory>
+ Beachten Sie bitte, dass die verzeichnisbasierte und
+ .htaccess-Konfiguration von EnableSendfile
+ nicht vom mod_disk_cache
-Modul unterst\ufffdtzt wird.
+ Nur die globale Konfiguration von EnableSendfile
+ wird vom Modul beachtet.
+
diff --git a/docs/manual/mod/core.html.en b/docs/manual/mod/core.html.en
index a55eb5fbbfe..6cee5ce3466 100644
--- a/docs/manual/mod/core.html.en
+++ b/docs/manual/mod/core.html.en
@@ -939,6 +939,12 @@ Locations
</Directory>
+ Please note that the per-directory and .htaccess configuration
+ of EnableSendfile
is not supported by
+ mod_disk_cache
.
+ Only global definition of EnableSendfile
+ is taken into account by the module.
+
diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml
index fa7b9045dcc..51226b92026 100644
--- a/docs/manual/mod/core.xml
+++ b/docs/manual/mod/core.xml
@@ -903,6 +903,12 @@ Locations
</Directory>
+ Please note that the per-directory and .htaccess configuration
+ of EnableSendfile is not supported by
+ mod_disk_cache.
+ Only global definition of EnableSendfile
+ is taken into account by the module.
+
diff --git a/docs/manual/mod/core.xml.de b/docs/manual/mod/core.xml.de
index 431bdf03f03..3e453096de5 100644
--- a/docs/manual/mod/core.xml.de
+++ b/docs/manual/mod/core.xml.de
@@ -925,6 +925,12 @@ Dateien an den Client auszuliefern
</Directory>
+ Beachten Sie bitte, dass die verzeichnisbasierte und
+ .htaccess-Konfiguration von EnableSendfile
+ nicht vom mod_disk_cache-Modul unterstützt wird.
+ Nur die globale Konfiguration von EnableSendfile
+ wird vom Modul beachtet.
+
diff --git a/docs/manual/mod/mod_disk_cache.html.en b/docs/manual/mod/mod_disk_cache.html.en
index e29839f16f7..b2ea343777b 100644
--- a/docs/manual/mod/mod_disk_cache.html.en
+++ b/docs/manual/mod/mod_disk_cache.html.en
@@ -32,7 +32,7 @@
Summary
mod_disk_cache
implements a disk based storage
- manager. It is primarily of use in conjunction
+ manager. It is primarily of use in conjunction with
mod_cache
.
Content is stored in and retrieved from the cache using URI based
@@ -45,6 +45,16 @@
mod_disk_cache
requires the services of
mod_cache
.
+ Note:
+
mod_disk_cache
uses the sendfile feature to
+ serve files from the cache when supported by the platform, and
+ when enabled with EnableSendfile
.
+ However, per-directory and .htaccess configuration of
+ EnableSendfile
are ignored my
+ mod_disk_cache
as the corresponding settings are not
+ available to the module when a request is being served from the
+ cache.
+
Directives
diff --git a/docs/manual/mod/mod_disk_cache.xml b/docs/manual/mod/mod_disk_cache.xml
index 806fe0bb65d..ff2b86a1840 100644
--- a/docs/manual/mod/mod_disk_cache.xml
+++ b/docs/manual/mod/mod_disk_cache.xml
@@ -30,7 +30,7 @@
mod_disk_cache implements a disk based storage
- manager. It is primarily of use in conjunction
+ manager. It is primarily of use in conjunction with
mod_cache.
Content is stored in and retrieved from the cache using URI based
@@ -43,6 +43,16 @@
mod_disk_cache requires the services of
mod_cache.
+ Note:
+ mod_disk_cache uses the sendfile feature to
+ serve files from the cache when supported by the platform, and
+ when enabled with EnableSendfile.
+ However, per-directory and .htaccess configuration of
+ EnableSendfile are ignored my
+ mod_disk_cache as the corresponding settings are not
+ available to the module when a request is being served from the
+ cache.
+
diff --git a/modules/cache/mod_disk_cache.c b/modules/cache/mod_disk_cache.c
index fd7cc6c893b..12dd841e032 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) {