- Introduce concept of context prefix (which is an URL prefix)

and context document root (which is the file system directory that
  this URL prefix is mapped to). This generalization of the document
  root makes it easier for scripts to create self-referential URLs and
  to find their files.
- Expose CONTEXT_DOCUMENT_ROOT and CONTEXT_PREFIX as envvars, in mod_rewrite,
  and in ap_expr.
- Make mod_alias and mod_userdir set the context information.
- Allow to override the document root on a per-request basis. This allows
  mass vhosting modules to set DOCUMENT_ROOT correctly.
- Make mod_vhost_alias set the per-request document root

PR: 26052, 46198, 49705

Remaining tasks:
- Use the context document root & prefix in mod_rewrite to make RewriteBase
  unneccessary in many cases. Do this without breaking compatibility.
- Write docs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132494 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Fritsch
2011-06-05 21:33:12 +00:00
parent 93623482e3
commit feca55db60
11 changed files with 174 additions and 38 deletions

View File

@ -238,6 +238,9 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r)
ap_get_remote_host(c, r->per_dir_config, REMOTE_HOST, NULL));
apr_table_addn(e, "REMOTE_ADDR", c->remote_ip);
apr_table_addn(e, "DOCUMENT_ROOT", ap_document_root(r)); /* Apache */
apr_table_setn(e, "REQUEST_SCHEME", ap_http_scheme(r));
apr_table_addn(e, "CONTEXT_PREFIX", ap_context_prefix(r));
apr_table_addn(e, "CONTEXT_DOCUMENT_ROOT", ap_context_document_root(r));
apr_table_addn(e, "SERVER_ADMIN", s->server_admin); /* Apache */
apr_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */
@ -337,7 +340,6 @@ AP_DECLARE(void) ap_add_cgi_vars(request_rec *r)
apr_table_setn(e, "GATEWAY_INTERFACE", "CGI/1.1");
apr_table_setn(e, "SERVER_PROTOCOL", r->protocol);
apr_table_setn(e, "REQUEST_METHOD", r->method);
apr_table_setn(e, "REQUEST_SCHEME", ap_http_scheme(r));
apr_table_setn(e, "QUERY_STRING", r->args ? r->args : "");
apr_table_setn(e, "REQUEST_URI", original_uri(r));