Ruediger Pluem wrote on 2009-02-08 22:36:47:
> > Well, but if EnableSendfile is configured in the main config
> > or vhost we get the setting by looking at the core_module config.
> > Of course you are right that this doesn't work when it is defined
> > inside a Location or Directory section.
>
> Well I am not sure if the core_dir_config structure is already setup
> during the quick handler phase (even for settings done on VHOST
> level).
Yes, it is. The following seems to work fine:
Index: mod_disk_cache.c
===================================================================
--- mod_disk_cache.c (revision 742187)
+++ mod_disk_cache.c (working copy)
@@ -471,7 +471,10 @@
/* Open the data file */
flags = APR_READ|APR_BINARY;
#ifdef APR_SENDFILE_ENABLED
- flags |= APR_SENDFILE_ENABLED;
+ core_dir_config *coreconf = ap_get_module_config(r->per_dir_config,
+ &core_module);
+ 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) {
Unless this gets a -1 from anyone I'll commit this to trunk
together with an appropriate note in the documentation.
ciao...
--
Lars Eilebrecht
[email protected]