From 4d0625fd50d141c5754f9658d96bb676d0cfa9fe Mon Sep 17 00:00:00 2001 From: Bill Stoddard Date: Sat, 19 Oct 2002 18:24:40 +0000 Subject: [PATCH] Fix breakage in mod_mem_cache caused by the EnableSendFile patch. Specifically, we need to save the file open flags from the file opened by the default handler. Retrive those flags when building the apr_file_t on a cache hit. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97265 13f79535-47bb-0310-9956-ffa450edef68 --- modules/experimental/mod_mem_cache.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/experimental/mod_mem_cache.c b/modules/experimental/mod_mem_cache.c index b5476eb999..0b25c8770a 100644 --- a/modules/experimental/mod_mem_cache.c +++ b/modules/experimental/mod_mem_cache.c @@ -96,6 +96,7 @@ typedef struct mem_cache_object { apr_size_t m_len; void *m; apr_os_file_t fd; + apr_int32_t flags; /* File open flags */ long priority; /**< the priority of this entry */ long total_refs; /**< total number of references this entry has had */ @@ -801,7 +802,7 @@ static apr_status_t read_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_briga if (mobj->type == CACHE_TYPE_FILE) { /* CACHE_TYPE_FILE */ apr_file_t *file; - apr_os_file_put(&file, &mobj->fd, APR_READ|APR_XTHREAD, p); + apr_os_file_put(&file, &mobj->fd, mobj->flags, p); b = apr_bucket_file_create(file, 0, mobj->m_len, p, bb->bucket_alloc); } else { @@ -929,8 +930,9 @@ static apr_status_t write_body(cache_handle_t *h, request_rec *r, apr_bucket_bri const char *name; /* Open a new XTHREAD handle to the file */ apr_file_name_get(&name, file); - rv = apr_file_open(&tmpfile, name, - APR_READ | APR_BINARY | APR_XTHREAD | APR_FILE_NOCLEANUP, + mobj->flags = ((APR_SENDFILE_ENABLED & apr_file_flags_get(file)) + | APR_READ | APR_BINARY | APR_XTHREAD | APR_FILE_NOCLEANUP); + rv = apr_file_open(&tmpfile, name, mobj->flags, APR_OS_DEFAULT, r->pool); if (rv != APR_SUCCESS) { return rv; -- 2.50.1