mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Add a sub-request filter. This filter just strips the EOS from the
brigade generated by the sub-request. If this is not done, then the main-request's core_output_filter will get very confused, as will any other filter in the main-request filter-stack that looks for EOS. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86618 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
12
STATUS
12
STATUS
@@ -1,5 +1,5 @@
|
||||
Apache 2.0 STATUS:
|
||||
Last modified at [$Date: 2000/10/13 16:57:08 $]
|
||||
Last modified at [$Date: 2000/10/16 23:15:54 $]
|
||||
|
||||
Release:
|
||||
|
||||
@@ -20,14 +20,8 @@ RELEASE SHOWSTOPPERS:
|
||||
|
||||
* All of the bucket types must be implemented. The list can be found
|
||||
in src/include/ap_buckets.h. May need to implement a bucket type
|
||||
to mark the end of a subrequest content stream, and one to tell
|
||||
filters to flush any pending content. See http_protocol.c:
|
||||
ap_finalize_sub_req_protocol() and ap_rflush()
|
||||
rbb says: Creating a bucket to signal end of sub-request ties
|
||||
the filters to Apache. This can be handled very cleanly
|
||||
by just inserting a sub-request filter. That filter would
|
||||
be responsible for stripping off the EOS bucket for the
|
||||
sub-request, and removing all vestiges of the request.
|
||||
to tell filters to flush any pending content. See http_protocol.c:
|
||||
ap_rflush()
|
||||
|
||||
* Remove Buff from the code. Some buff functionality is currently
|
||||
missing: input translation filter, translation of protocol data for
|
||||
|
@@ -60,6 +60,7 @@
|
||||
#define APACHE_HTTP_REQUEST_H
|
||||
|
||||
#include "ap_hooks.h"
|
||||
#include "util_filter.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -121,6 +122,15 @@ AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
|
||||
AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
|
||||
const char *new_file,
|
||||
const request_rec *r);
|
||||
/**
|
||||
* 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.
|
||||
* @param f The current filter
|
||||
* @param bb The brigade to filter
|
||||
* @deffuc apr_status_t ap_sub_req_output_filter(ap_filter_t *f, ap_bucket_brigade *bb)
|
||||
*/
|
||||
AP_CORE_DECLARE(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f,
|
||||
ap_bucket_brigade *bb);
|
||||
|
||||
/**
|
||||
* Run the handler for the sub request
|
||||
|
@@ -3584,6 +3584,8 @@ static void register_hooks(void)
|
||||
ap_register_input_filter("DECHUNK", dechunk_filter, AP_FTYPE_CONNECTION + 1);
|
||||
ap_register_input_filter("CORE_IN", core_input_filter, AP_FTYPE_CONNECTION);
|
||||
ap_register_output_filter("CORE", core_output_filter, AP_FTYPE_CONNECTION + 1);
|
||||
ap_register_output_filter("SUBREQ_CORE", ap_sub_req_output_filter,
|
||||
AP_FTYPE_CONTENT);
|
||||
ap_register_output_filter("CHUNK", chunk_filter, AP_FTYPE_CONNECTION);
|
||||
ap_register_output_filter("BUFFER", buffer_filter, AP_FTYPE_CONNECTION);
|
||||
}
|
||||
|
@@ -1560,12 +1560,7 @@ static void end_output_stream(request_rec *r)
|
||||
|
||||
void ap_finalize_sub_req_protocol(request_rec *sub)
|
||||
{
|
||||
/* tell the filter chain there is no more content coming */
|
||||
/* ### crap. we need to tell the subrequest's filters that no more
|
||||
### is coming. there is definitely more for the parent requests.
|
||||
### create a SUB_EOS bucket?
|
||||
*/
|
||||
/* end_output_stream(sub); */
|
||||
end_output_stream(sub);
|
||||
|
||||
SET_BYTES_SENT(sub->main);
|
||||
}
|
||||
|
@@ -817,6 +817,19 @@ static request_rec *make_sub_request(const request_rec *r)
|
||||
return rr;
|
||||
}
|
||||
|
||||
AP_CORE_DECLARE(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f,
|
||||
ap_bucket_brigade *bb)
|
||||
{
|
||||
ap_bucket *e = AP_BRIGADE_LAST(bb);
|
||||
|
||||
if (AP_BUCKET_IS_EOS(e)) {
|
||||
AP_BUCKET_REMOVE(e);
|
||||
ap_bucket_destroy(e);
|
||||
}
|
||||
ap_pass_brigade(f->next, bb);
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
|
||||
const char *new_file,
|
||||
const request_rec *r)
|
||||
@@ -840,6 +853,8 @@ AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
|
||||
|
||||
/* start with the same set of output filters */
|
||||
rnew->output_filters = r->output_filters;
|
||||
ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection);
|
||||
|
||||
/* no input filters for a subrequest */
|
||||
|
||||
ap_set_sub_req_protocol(rnew, r);
|
||||
@@ -936,6 +951,8 @@ AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
|
||||
|
||||
/* start with the same set of output filters */
|
||||
rnew->output_filters = r->output_filters;
|
||||
ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection);
|
||||
|
||||
/* no input filters for a subrequest */
|
||||
|
||||
ap_set_sub_req_protocol(rnew, r);
|
||||
|
Reference in New Issue
Block a user