From: Graham Leggett Date: Fri, 9 Oct 2009 21:41:31 +0000 (+0000) Subject: mod_dav: Provide a mechanism to obtain the request_rec and pathname X-Git-Tag: 2.3.3~178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a107e738e360664d42e2079e27f66b6e44d40a2;p=apache mod_dav: Provide a mechanism to obtain the request_rec and pathname from the dav_resource. Submitted by: Jari Urpalainen , Brian France git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@823703 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index def7544af9..8f509176eb 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,10 @@ Changes with Apache 2.3.3 mod_proxy_ftp: NULL pointer dereference on error paths. [Stefan Fritsch , Joe Orton] + *) mod_dav: Provide a mechanism to obtain the request_rec and pathname + from the dav_resource. [Jari Urpalainen , + Brian France ] + *) Build: Use install instead of cp if available on installing modules to avoid segmentation fault. PR 47951. [hirose31 gmail.com] diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index 8364ab686d..97006a68a0 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -46,6 +46,7 @@ struct dav_resource_private { apr_pool_t *pool; /* memory storage pool associated with request */ const char *pathname; /* full pathname to resource */ apr_finfo_t finfo; /* filesystem info */ + request_rec *r; }; /* private context for doing a filesystem walk */ @@ -210,6 +211,11 @@ static dav_error * dav_fs_internal_walk(const dav_walk_params *params, ** ** PRIVATE REPOSITORY FUNCTIONS */ +request_rec *dav_fs_get_request_rec(const dav_resource *resource) +{ + return resource->info->r; +} + apr_pool_t *dav_fs_pool(const dav_resource *resource) { return resource->info->pool; @@ -648,6 +654,7 @@ static dav_error * dav_fs_get_resource( /* Create private resource context descriptor */ ctx = apr_pcalloc(r->pool, sizeof(*ctx)); ctx->finfo = r->finfo; + ctx->r = r; /* ### this should go away */ ctx->pool = r->pool; @@ -1816,6 +1823,9 @@ static const dav_hooks_repository dav_hooks_repository_fs = dav_fs_remove_resource, dav_fs_walk, dav_fs_getetag, + dav_fs_get_request_rec, + dav_fs_pathname, + NULL }; static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, diff --git a/modules/dav/main/mod_dav.h b/modules/dav/main/mod_dav.h index ac04cda419..7a402e52e7 100644 --- a/modules/dav/main/mod_dav.h +++ b/modules/dav/main/mod_dav.h @@ -1940,6 +1940,12 @@ struct dav_hooks_repository ** then this field may be used. In most cases, it will just be NULL. */ void *ctx; + + /* return request record */ + request_rec * (*get_request_rec)(const dav_resource *resource); + + /* return path */ + const char * (*get_pathname)(const dav_resource *resource); };