You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/10/17 01:15:57 UTC
cvs commit: apache-2.0/src/main http_core.c http_protocol.c http_request.c
rbb 00/10/16 16:15:57
Modified: . STATUS
src CHANGES
src/include http_request.h
src/main http_core.c http_protocol.c http_request.c
Log:
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.
Revision Changes Path
1.142 +3 -9 apache-2.0/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/apache-2.0/STATUS,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -r1.141 -r1.142
--- STATUS 2000/10/13 16:57:08 1.141
+++ STATUS 2000/10/16 23:15:54 1.142
@@ -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 @@
* 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
1.277 +6 -0 apache-2.0/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-2.0/src/CHANGES,v
retrieving revision 1.276
retrieving revision 1.277
diff -u -r1.276 -r1.277
--- CHANGES 2000/10/16 18:00:26 1.276
+++ CHANGES 2000/10/16 23:15:54 1.277
@@ -1,4 +1,10 @@
Changes with Apache 2.0a8
+ *) Add an output filter for sub-requests. This filter just strips the
+ EOS bucket so that we don't confuse the main request's core output
+ filter by sending multiple EOS buckets. This change also makes sub
+ requests start to send EOS buckets when they are finished.
+ [Ryan Bloom]
+
*) Make ap_bucket_(read|destroy|split|setaside) into macros. Also
makes ap_bucket_destroy a return void, which is okay because it
used to always return APR_SUCCESS, and nobody ever checked its
1.18 +10 -0 apache-2.0/src/include/http_request.h
Index: http_request.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/include/http_request.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- http_request.h 2000/10/16 06:04:34 1.17
+++ http_request.h 2000/10/16 23:15:54 1.18
@@ -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_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
1.173 +2 -0 apache-2.0/src/main/http_core.c
Index: http_core.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -r1.172 -r1.173
--- http_core.c 2000/10/16 19:11:52 1.172
+++ http_core.c 2000/10/16 23:15:55 1.173
@@ -3584,6 +3584,8 @@
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);
}
1.179 +1 -6 apache-2.0/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -r1.178 -r1.179
--- http_protocol.c 2000/10/16 22:10:41 1.178
+++ http_protocol.c 2000/10/16 23:15:55 1.179
@@ -1560,12 +1560,7 @@
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);
}
1.60 +17 -0 apache-2.0/src/main/http_request.c
Index: http_request.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_request.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- http_request.c 2000/10/16 18:00:33 1.59
+++ http_request.c 2000/10/16 23:15:55 1.60
@@ -817,6 +817,19 @@
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 @@
/* 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 @@
/* 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);