* inspected to find information about the requested URI
* @param new_file The URI to lookup
* @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
* @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,
- 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
* inspected to find information about the requested file
* @param new_file The URI to lookup
* @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
* @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,
- 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
* sub request can be inspected to find information about the requested URI
* @param method The method to use in the new sub request
* @param new_file The URI to lookup
* @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
* @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,
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
* has to be inserted at the end of a sub-requests filter stack.
* pretend there's nothing there.
*/
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->filename != NULL)
&& rr->finfo.filetype == APR_REG) {
* pretend there's nothing there.
*/
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->filename != NULL)
&& rr->finfo.filetype == APR_REG) {
p->version_sort = autoindex_opts & VERSION_SORT;
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) {
p->lm = rr->finfo.mtime;
ap_set_last_modified(r);
ap_set_etag(r);
apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
- ap_set_content_length(r, r->finfo.size);
+ ap_set_content_length(r, r->finfo.size);
if ((errstatus = ap_meets_conditions(r)) != OK) {
apr_close(fd);
return errstatus;
AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
const char *new_file,
- const request_rec *r)
+ const request_rec *r,
+ ap_filter_t *next_filter)
{
request_rec *rnew;
int res;
ap_copy_method_list(rnew->allowed_methods, r->allowed_methods);
/* 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);
/* no input filters for a subrequest */
}
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,
- const request_rec *r)
+ const request_rec *r,
+ ap_filter_t *next_filter)
{
request_rec *rnew;
int res;
ap_copy_method_list(rnew->allowed_methods, r->allowed_methods);
/* 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);
/* no input filters for a subrequest */
for (; num_names; ++names_ptr, --num_names) {
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) {
char *new_uri = ap_escape_uri(r->pool, rr->uri);
* 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,
* since that's a good indication of the sort of thing it
if (!variant->sub_req) {
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;
if (status != HTTP_OK &&
* 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) {
res = sub_req->status;
ap_destroy_sub_req(sub_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) {
#ifdef WIN32