mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Allow modules to specify the first module for a sub-request. This allows
modules to not have to muck with the output_filter after it creates the sub-request. Without this change, modules that create a sub-request have to manually edit the output_filters, and therefore skip the sub-request output_filter. If they skip the sub-request output_filter, then we end up sending multiple EOS buckets to the core_output_filter. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87065 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -95,33 +95,43 @@ extern "C" {
|
|||||||
* inspected to find information about the requested URI
|
* inspected to find information about the requested URI
|
||||||
* @param new_file The URI to lookup
|
* @param new_file The URI to lookup
|
||||||
* @param r The current request
|
* @param r The current request
|
||||||
|
* @param next_filter The first filter the sub_request should use. If this is
|
||||||
|
* NULL, it defaults to the first filter for the main request
|
||||||
* @return The new request record
|
* @return The new request record
|
||||||
* @deffunc request_rec * ap_sub_req_lookup_uri(const char *new_file, const request_rec *r)
|
* @deffunc request_rec * ap_sub_req_lookup_uri(const char *new_file, const request_rec *r)
|
||||||
*/
|
*/
|
||||||
AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_file,
|
AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_file,
|
||||||
const request_rec *r);
|
const request_rec *r,
|
||||||
|
ap_filter_t *next_filter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a sub request for the given file. This sub request can be
|
* Create a sub request for the given file. This sub request can be
|
||||||
* inspected to find information about the requested file
|
* inspected to find information about the requested file
|
||||||
* @param new_file The URI to lookup
|
* @param new_file The URI to lookup
|
||||||
* @param r The current request
|
* @param r The current request
|
||||||
|
* @param next_filter The first filter the sub_request should use. If this is
|
||||||
|
* NULL, it defaults to the first filter for the main request
|
||||||
* @return The new request record
|
* @return The new request record
|
||||||
* @deffunc request_rec * ap_sub_req_lookup_file(const char *new_file, const request_rec *r)
|
* @deffunc request_rec * ap_sub_req_lookup_file(const char *new_file, const request_rec *r)
|
||||||
*/
|
*/
|
||||||
AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
|
AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
|
||||||
const request_rec *r);
|
const request_rec *r,
|
||||||
|
ap_filter_t *next_filter);
|
||||||
/**
|
/**
|
||||||
* Create a sub request for the given URI using a specific method. This
|
* Create a sub request for the given URI using a specific method. This
|
||||||
* sub request can be inspected to find information about the requested URI
|
* sub request can be inspected to find information about the requested URI
|
||||||
* @param method The method to use in the new sub request
|
* @param method The method to use in the new sub request
|
||||||
* @param new_file The URI to lookup
|
* @param new_file The URI to lookup
|
||||||
* @param r The current request
|
* @param r The current request
|
||||||
|
* @param next_filter The first filter the sub_request should use. If this is
|
||||||
|
* NULL, it defaults to the first filter for the main request
|
||||||
* @return The new request record
|
* @return The new request record
|
||||||
* @deffunc request_rec * ap_sub_req_method_uri(const char *method, const char *new_file, const request_rec *r)
|
* @deffunc request_rec * ap_sub_req_method_uri(const char *method, const char *new_file, const request_rec *r)
|
||||||
*/
|
*/
|
||||||
AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
|
AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
|
||||||
const char *new_file,
|
const char *new_file,
|
||||||
const request_rec *r);
|
const request_rec *r,
|
||||||
|
ap_filter_t *next_filter);
|
||||||
/**
|
/**
|
||||||
* An output filter to strip EOS buckets from sub-requests. This always
|
* An output filter to strip EOS buckets from sub-requests. This always
|
||||||
* has to be inserted at the end of a sub-requests filter stack.
|
* has to be inserted at the end of a sub-requests filter stack.
|
||||||
|
@@ -974,7 +974,7 @@ static void emit_head(request_rec *r, char *header_fname, int suppress_amble,
|
|||||||
* pretend there's nothing there.
|
* pretend there's nothing there.
|
||||||
*/
|
*/
|
||||||
if ((header_fname != NULL)
|
if ((header_fname != NULL)
|
||||||
&& (rr = ap_sub_req_lookup_uri(header_fname, r))
|
&& (rr = ap_sub_req_lookup_uri(header_fname, r, NULL))
|
||||||
&& (rr->status == HTTP_OK)
|
&& (rr->status == HTTP_OK)
|
||||||
&& (rr->filename != NULL)
|
&& (rr->filename != NULL)
|
||||||
&& rr->finfo.filetype == APR_REG) {
|
&& rr->finfo.filetype == APR_REG) {
|
||||||
@@ -1057,7 +1057,7 @@ static void emit_tail(request_rec *r, char *readme_fname, int suppress_amble)
|
|||||||
* pretend there's nothing there.
|
* pretend there's nothing there.
|
||||||
*/
|
*/
|
||||||
if ((readme_fname != NULL)
|
if ((readme_fname != NULL)
|
||||||
&& (rr = ap_sub_req_lookup_uri(readme_fname, r))
|
&& (rr = ap_sub_req_lookup_uri(readme_fname, r, NULL))
|
||||||
&& (rr->status == HTTP_OK)
|
&& (rr->status == HTTP_OK)
|
||||||
&& (rr->filename != NULL)
|
&& (rr->filename != NULL)
|
||||||
&& rr->finfo.filetype == APR_REG) {
|
&& rr->finfo.filetype == APR_REG) {
|
||||||
@@ -1184,7 +1184,7 @@ static struct ent *make_autoindex_entry(char *name, int autoindex_opts,
|
|||||||
p->version_sort = autoindex_opts & VERSION_SORT;
|
p->version_sort = autoindex_opts & VERSION_SORT;
|
||||||
|
|
||||||
if (autoindex_opts & FANCY_INDEXING) {
|
if (autoindex_opts & FANCY_INDEXING) {
|
||||||
request_rec *rr = ap_sub_req_lookup_file(name, r);
|
request_rec *rr = ap_sub_req_lookup_file(name, r, NULL);
|
||||||
|
|
||||||
if (rr->finfo.protection != 0) {
|
if (rr->finfo.protection != 0) {
|
||||||
p->lm = rr->finfo.mtime;
|
p->lm = rr->finfo.mtime;
|
||||||
|
@@ -806,7 +806,8 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f,
|
|||||||
|
|
||||||
AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
|
AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
|
||||||
const char *new_file,
|
const char *new_file,
|
||||||
const request_rec *r)
|
const request_rec *r,
|
||||||
|
ap_filter_t *next_filter)
|
||||||
{
|
{
|
||||||
request_rec *rnew;
|
request_rec *rnew;
|
||||||
int res;
|
int res;
|
||||||
@@ -830,7 +831,12 @@ AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
|
|||||||
ap_copy_method_list(rnew->allowed_methods, r->allowed_methods);
|
ap_copy_method_list(rnew->allowed_methods, r->allowed_methods);
|
||||||
|
|
||||||
/* start with the same set of output filters */
|
/* start with the same set of output filters */
|
||||||
rnew->output_filters = r->output_filters;
|
if (next_filter) {
|
||||||
|
rnew->output_filters = next_filter;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rnew->output_filters = r->output_filters;
|
||||||
|
}
|
||||||
ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection);
|
ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection);
|
||||||
|
|
||||||
/* no input filters for a subrequest */
|
/* no input filters for a subrequest */
|
||||||
@@ -902,13 +908,15 @@ AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
|
|||||||
}
|
}
|
||||||
|
|
||||||
AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_file,
|
AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_file,
|
||||||
const request_rec *r)
|
const request_rec *r,
|
||||||
|
ap_filter_t *next_filter)
|
||||||
{
|
{
|
||||||
return ap_sub_req_method_uri("GET", new_file, r);
|
return ap_sub_req_method_uri("GET", new_file, r, next_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
|
AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
|
||||||
const request_rec *r)
|
const request_rec *r,
|
||||||
|
ap_filter_t *next_filter)
|
||||||
{
|
{
|
||||||
request_rec *rnew;
|
request_rec *rnew;
|
||||||
int res;
|
int res;
|
||||||
@@ -932,7 +940,12 @@ AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
|
|||||||
ap_copy_method_list(rnew->allowed_methods, r->allowed_methods);
|
ap_copy_method_list(rnew->allowed_methods, r->allowed_methods);
|
||||||
|
|
||||||
/* start with the same set of output filters */
|
/* start with the same set of output filters */
|
||||||
rnew->output_filters = r->output_filters;
|
if (next_filter) {
|
||||||
|
rnew->output_filters = next_filter;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rnew->output_filters = r->output_filters;
|
||||||
|
}
|
||||||
ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection);
|
ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection);
|
||||||
|
|
||||||
/* no input filters for a subrequest */
|
/* no input filters for a subrequest */
|
||||||
|
@@ -161,7 +161,7 @@ static int handle_dir(request_rec *r)
|
|||||||
|
|
||||||
for (; num_names; ++names_ptr, --num_names) {
|
for (; num_names; ++names_ptr, --num_names) {
|
||||||
char *name_ptr = *names_ptr;
|
char *name_ptr = *names_ptr;
|
||||||
request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r);
|
request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r, r->output_filters);
|
||||||
|
|
||||||
if (rr->status == HTTP_OK && rr->finfo.filetype == APR_REG) {
|
if (rr->status == HTTP_OK && rr->finfo.filetype == APR_REG) {
|
||||||
char *new_uri = ap_escape_uri(r->pool, rr->uri);
|
char *new_uri = ap_escape_uri(r->pool, rr->uri);
|
||||||
|
@@ -949,7 +949,7 @@ static int read_types_multi(negotiation_state *neg)
|
|||||||
* which we'll be slapping default_type on later).
|
* which we'll be slapping default_type on later).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sub_req = ap_sub_req_lookup_file(d_name, r);
|
sub_req = ap_sub_req_lookup_file(d_name, r, NULL);
|
||||||
|
|
||||||
/* If it has a handler, we'll pretend it's a CGI script,
|
/* If it has a handler, we'll pretend it's a CGI script,
|
||||||
* since that's a good indication of the sort of thing it
|
* since that's a good indication of the sort of thing it
|
||||||
@@ -2314,7 +2314,7 @@ static int setup_choice_response(request_rec *r, negotiation_state *neg,
|
|||||||
if (!variant->sub_req) {
|
if (!variant->sub_req) {
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
sub_req = ap_sub_req_lookup_file(variant->file_name, r);
|
sub_req = ap_sub_req_lookup_file(variant->file_name, r, NULL);
|
||||||
status = sub_req->status;
|
status = sub_req->status;
|
||||||
|
|
||||||
if (status != HTTP_OK &&
|
if (status != HTTP_OK &&
|
||||||
@@ -2625,7 +2625,7 @@ static int handle_multi(request_rec *r)
|
|||||||
* a sub_req structure yet. Get one now.
|
* a sub_req structure yet. Get one now.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sub_req = ap_sub_req_lookup_file(best->file_name, r);
|
sub_req = ap_sub_req_lookup_file(best->file_name, r, NULL);
|
||||||
if (sub_req->status != HTTP_OK) {
|
if (sub_req->status != HTTP_OK) {
|
||||||
res = sub_req->status;
|
res = sub_req->status;
|
||||||
ap_destroy_sub_req(sub_req);
|
ap_destroy_sub_req(sub_req);
|
||||||
|
@@ -351,7 +351,8 @@ AP_DECLARE(void) ap_add_cgi_vars(request_rec *r)
|
|||||||
*/
|
*/
|
||||||
request_rec *pa_req;
|
request_rec *pa_req;
|
||||||
|
|
||||||
pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info), r);
|
pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info), r,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (pa_req->filename) {
|
if (pa_req->filename) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
Reference in New Issue
Block a user