ASF Bugzilla – Attachment 25843 Details for
Bug 49705
Per request DocumentRoot
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Implementation of per request DocumentRoot
httpd-trunk-per-request-document-root.patch (text/plain), 4.89 KB, created by
Ondrej Sury
on 2010-08-05 04:40:21 UTC
(
hide
)
Description:
Implementation of per request DocumentRoot
Filename:
MIME Type:
Creator:
Ondrej Sury
Created:
2010-08-05 04:40:21 UTC
Size:
4.89 KB
patch
obsolete
>Index: server/core.c >=================================================================== >--- server/core.c (revision 965372) >+++ server/core.c (working copy) >@@ -717,11 +717,15 @@ > AP_DECLARE(const char *) ap_document_root(request_rec *r) /* Don't use this! */ > { > core_server_config *conf; >+ if (r->document_root == NULL) { >+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, >+ "ap_document_root: r->document_root is not set"); >+ conf = (core_server_config *)ap_get_module_config(r->server->module_config, >+ &core_module); >+ return conf->ap_document_root; >+ } > >- conf = (core_server_config *)ap_get_module_config(r->server->module_config, >- &core_module); >- >- return conf->ap_document_root; >+ return r->document_root; > } > > /* Should probably just get rid of this... the only code that cares is >@@ -3521,7 +3525,7 @@ > while (*path == '/') { > ++path; > } >- if ((rv = apr_filepath_merge(&r->filename, conf->ap_document_root, path, >+ if ((rv = apr_filepath_merge(&r->filename, ap_document_root(r), path, > APR_FILEPATH_TRUENAME > | APR_FILEPATH_SECUREROOT, r->pool)) > != APR_SUCCESS) { >@@ -3544,7 +3548,7 @@ > while (*path == '/') { > ++path; > } >- if ((rv = apr_filepath_merge(&r->filename, conf->ap_document_root, path, >+ if ((rv = apr_filepath_merge(&r->filename, ap_document_root(r), path, > APR_FILEPATH_TRUENAME > | APR_FILEPATH_SECUREROOT, r->pool)) > != APR_SUCCESS) { >Index: server/protocol.c >=================================================================== >--- server/protocol.c (revision 965372) >+++ server/protocol.c (working copy) >@@ -866,6 +866,7 @@ > apr_bucket_brigade *tmp_bb; > apr_socket_t *csd; > apr_interval_time_t cur_timeout; >+ core_server_config *server_conf; > > > apr_pool_create(&p, conn->pool); >@@ -910,6 +911,12 @@ > */ > r->used_path_info = AP_REQ_DEFAULT_PATH_INFO; > >+ /* Clone DocumentRoot so it can be changed per request >+ */ >+ server_conf = (core_server_config *)ap_get_module_config(r->server->module_config, >+ &core_module); >+ r->document_root = server_conf->ap_document_root; >+ > tmp_bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); > > /* Get the request... */ >Index: server/request.c >=================================================================== >--- server/request.c (revision 965372) >+++ server/request.c (working copy) >@@ -1693,6 +1693,10 @@ > /* Pass on the kept body (if any) into the new request. */ > rnew->kept_body = r->kept_body; > >+ /* Copy DocumentRoot to sub-request >+ */ >+ rnew->document_root = r->document_root; >+ > return rnew; > } > >Index: modules/http/http_request.c >=================================================================== >--- modules/http/http_request.c (revision 965372) >+++ modules/http/http_request.c (working copy) >@@ -456,6 +456,7 @@ > new->hostname = r->hostname; > new->request_time = r->request_time; > new->main = r->main; >+ new->document_root = r->document_root; > > new->headers_in = r->headers_in; > new->headers_out = apr_table_make(r->pool, 12); >@@ -558,6 +559,8 @@ > r->content_encoding = rr->content_encoding; > r->content_languages = rr->content_languages; > r->per_dir_config = rr->per_dir_config; >+ r->document_root = rr->document_root; >+ > /* copy output headers from subrequest, but leave negotiation headers */ > r->notes = apr_table_overlay(r->pool, rr->notes, r->notes); > r->headers_out = apr_table_overlay(r->pool, rr->headers_out, >Index: modules/mappers/mod_vhost_alias.c >=================================================================== >--- modules/mappers/mod_vhost_alias.c (revision 965372) >+++ modules/mappers/mod_vhost_alias.c (working copy) >@@ -373,11 +373,12 @@ > } > > if (r->filename) { >- r->filename = apr_pstrcat(r->pool, r->filename, buf, uri, NULL); >+ r->document_root = apr_pstrcat(r->pool, r->filename, buf, NULL); > } > else { >- r->filename = apr_pstrcat(r->pool, buf, uri, NULL); >+ r->document_root = apr_pstrdup(r->pool, buf); > } >+ r->filename = apr_pstrcat(r->pool, r->document_root, uri, NULL); > } > > static int mva_translate(request_rec *r) >Index: include/httpd.h >=================================================================== >--- include/httpd.h (revision 965372) >+++ include/httpd.h (working copy) >@@ -996,6 +996,14 @@ > apr_uri_t parsed_uri; > /** finfo.protection (st_mode) set to zero if no such file */ > apr_finfo_t finfo; >+ >+ /* Various config pulled from r->server which could be set by >+ * vhost modules >+ */ >+ >+ /** Where is the per requests document root **/ >+ const char *document_root; >+ > }; > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 49705
: 25843