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...@apache.org on 2001/08/02 06:59:51 UTC
cvs commit: httpd-2.0/modules/filters mod_include.c
rbb 01/08/01 21:59:51
Modified: . CHANGES
modules/filters mod_include.c
Log:
Make the includes filter check return codes from filters lower in
the filter chain. If a lower level filter returns an error, then
the request needs to stop immediately. This allows mod_include to
stop parsing data once a lower filter recognizes an error.
PR: 8102
Revision Changes Path
1.271 +6 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.270
retrieving revision 1.271
diff -u -r1.270 -r1.271
--- CHANGES 2001/08/02 04:25:19 1.270
+++ CHANGES 2001/08/02 04:59:50 1.271
@@ -1,5 +1,11 @@
Changes with Apache 2.0.23-dev
+ *) Make the includes filter check return codes from filters lower in
+ the filter chain. If a lower level filter returns an error, then
+ the request needs to stop immediately. This allows mod_include to
+ stop parsing data once a lower filter recognizes an error.
+ [Ryan Bloom]
+
*) Add the ability to extend the methods that Apache understands
and have those methods <limit>able in the httpd.conf. It uses
the same bit mask/shifted offset as the original HTTP methods
1.117 +19 -9 httpd-2.0/modules/filters/mod_include.c
Index: mod_include.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- mod_include.c 2001/07/26 16:37:56 1.116
+++ mod_include.c 2001/08/02 04:59:51 1.117
@@ -2319,14 +2319,15 @@
/* -------------------------- The main function --------------------------- */
-static void send_parsed_content(apr_bucket_brigade **bb, request_rec *r,
- ap_filter_t *f)
+static apr_status_t send_parsed_content(apr_bucket_brigade **bb,
+ request_rec *r, ap_filter_t *f)
{
include_ctx_t *ctx = f->ctx;
apr_bucket *dptr = APR_BRIGADE_FIRST(*bb);
apr_bucket *tmp_dptr;
apr_bucket_brigade *tag_and_after;
int ret;
+ apr_status_t rv;
if (r->args) { /* add QUERY stuff to env cause it ain't yet */
char *arg_copy = apr_pstrdup(r->pool, r->args);
@@ -2384,7 +2385,10 @@
else if ((tmp_dptr != NULL) && (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD)) {
/* Send the large chunk of pre-tag bytes... */
tag_and_after = apr_brigade_split(*bb, tmp_dptr);
- ap_pass_brigade(f->next, *bb);
+ rv = ap_pass_brigade(f->next, *bb);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
*bb = tag_and_after;
dptr = tmp_dptr;
ctx->bytes_parsed = 0;
@@ -2572,7 +2576,10 @@
} while (dptr != APR_BRIGADE_SENTINEL(*bb));
}
else { /* Otherwise pass it along... */
- ap_pass_brigade(f->next, *bb); /* No SSI tags in this brigade... */
+ rv = ap_pass_brigade(f->next, *bb); /* No SSI tags in this brigade... */
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
ctx->bytes_parsed = 0;
}
}
@@ -2595,7 +2602,10 @@
/* Set aside tag, pass pre-tag... */
tag_and_after = apr_brigade_split(*bb, ctx->head_start_bucket);
ap_save_brigade(f, &ctx->ssi_tag_brigade, &tag_and_after, r->pool);
- ap_pass_brigade(f->next, *bb);
+ rv = ap_pass_brigade(f->next, *bb);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
ctx->bytes_parsed = 0;
}
}
@@ -2661,6 +2671,7 @@
request_rec *r = f->r;
include_ctx_t *ctx = f->ctx;
request_rec *parent;
+ apr_status_t rv;
include_dir_config *conf =
(include_dir_config *)ap_get_module_config(r->per_dir_config,
&include_module);
@@ -2688,8 +2699,7 @@
ctx->error_length = strlen(ctx->error_str);
}
else {
- ap_pass_brigade(f->next, b);
- return APR_ENOMEM;
+ return ap_pass_brigade(f->next, b);
}
}
else {
@@ -2740,7 +2750,7 @@
*/
apr_table_unset(f->r->headers_out, "Content-Length");
- send_parsed_content(&b, r, f);
+ rv = send_parsed_content(&b, r, f);
if (parent) {
/* signify that the sub request should not be killed */
@@ -2748,7 +2758,7 @@
NESTED_INCLUDE_MAGIC);
}
- return APR_SUCCESS;
+ return rv;
}
static void ap_register_include_handler(char *tag, include_handler_fn_t *func)
Re: cvs commit: httpd-2.0/modules/filters mod_include.c
Posted by Ryan Bloom <rb...@covalent.net>.
I didn't see it, so we should, and if nobody else does it, I'll do it tonight.
Ryan
On Thursday 02 August 2001 14:15, Bill Stoddard wrote:
> Do you plan to handle the pass_brigade hidden in
> SPLIT_AND_PASS_PRETAG_BUCKETS()?
>
> Bill
>
> ----- Original Message -----
> From: <rb...@apache.org>
> To: <ht...@apache.org>
> Sent: Thursday, August 02, 2001 12:59 AM
> Subject: cvs commit: httpd-2.0/modules/filters mod_include.c
>
> > rbb 01/08/01 21:59:51
> >
> > Modified: . CHANGES
> > modules/filters mod_include.c
> > Log:
> > Make the includes filter check return codes from filters lower in
> > the filter chain. If a lower level filter returns an error, then
> > the request needs to stop immediately. This allows mod_include to
> > stop parsing data once a lower filter recognizes an error.
> > PR: 8102
> >
> > Revision Changes Path
> > 1.271 +6 -0 httpd-2.0/CHANGES
> >
> > Index: CHANGES
> > ===================================================================
> > RCS file: /home/cvs/httpd-2.0/CHANGES,v
> > retrieving revision 1.270
> > retrieving revision 1.271
> > diff -u -r1.270 -r1.271
> > --- CHANGES 2001/08/02 04:25:19 1.270
> > +++ CHANGES 2001/08/02 04:59:50 1.271
> > @@ -1,5 +1,11 @@
> > Changes with Apache 2.0.23-dev
> >
> > + *) Make the includes filter check return codes from filters lower in
> > + the filter chain. If a lower level filter returns an error, then
> > + the request needs to stop immediately. This allows mod_include
> > to + stop parsing data once a lower filter recognizes an error. +
> > [Ryan Bloom]
> > +
> > *) Add the ability to extend the methods that Apache understands
> > and have those methods <limit>able in the httpd.conf. It uses
> > the same bit mask/shifted offset as the original HTTP methods
> >
> >
> >
> > 1.117 +19 -9 httpd-2.0/modules/filters/mod_include.c
> >
> > Index: mod_include.c
> > ===================================================================
> > RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
> > retrieving revision 1.116
> > retrieving revision 1.117
> > diff -u -r1.116 -r1.117
> > --- mod_include.c 2001/07/26 16:37:56 1.116
> > +++ mod_include.c 2001/08/02 04:59:51 1.117
> > @@ -2319,14 +2319,15 @@
> >
> > /* -------------------------- The main function
> > --------------------------- */
> >
> > -static void send_parsed_content(apr_bucket_brigade **bb, request_rec
> > *r, - ap_filter_t *f)
> > +static apr_status_t send_parsed_content(apr_bucket_brigade **bb,
> > + request_rec *r, ap_filter_t
> > *f) {
> > include_ctx_t *ctx = f->ctx;
> > apr_bucket *dptr = APR_BRIGADE_FIRST(*bb);
> > apr_bucket *tmp_dptr;
> > apr_bucket_brigade *tag_and_after;
> > int ret;
> > + apr_status_t rv;
> >
> > if (r->args) { /* add QUERY stuff to env cause it
> > ain't yet */ char *arg_copy = apr_pstrdup(r->pool, r->args);
> > @@ -2384,7 +2385,10 @@
> > else if ((tmp_dptr != NULL) && (ctx->bytes_parsed >=
>
> BYTE_COUNT_THRESHOLD)) {
>
> > /* Send the large chunk of pre-tag
> > bytes... */ tag_and_after = apr_brigade_split(*bb, tmp_dptr); -
> > ap_pass_brigade(f->next, *bb);
> > + rv = ap_pass_brigade(f->next, *bb);
> > + if (rv != APR_SUCCESS) {
> > + return rv;
> > + }
> > *bb = tag_and_after;
> > dptr = tmp_dptr;
> > ctx->bytes_parsed = 0;
> > @@ -2572,7 +2576,10 @@
> > } while (dptr != APR_BRIGADE_SENTINEL(*bb));
> > }
> > else { /* Otherwise pass it along... */
> > - ap_pass_brigade(f->next, *bb); /* No SSI tags in this
> > brigade... */ + rv = ap_pass_brigade(f->next, *bb); /* No SSI
> > tags in this brigade... */ + if (rv != APR_SUCCESS) {
> > + return rv;
> > + }
> > ctx->bytes_parsed = 0;
> > }
> > }
> > @@ -2595,7 +2602,10 @@
> > /* Set aside tag, pass pre-tag... */
> > tag_and_after = apr_brigade_split(*bb,
> > ctx->head_start_bucket); ap_save_brigade(f, &ctx->ssi_tag_brigade,
> > &tag_and_after, r->pool); - ap_pass_brigade(f->next, *bb);
> > + rv = ap_pass_brigade(f->next, *bb);
> > + if (rv != APR_SUCCESS) {
> > + return rv;
> > + }
> > ctx->bytes_parsed = 0;
> > }
> > }
> > @@ -2661,6 +2671,7 @@
> > request_rec *r = f->r;
> > include_ctx_t *ctx = f->ctx;
> > request_rec *parent;
> > + apr_status_t rv;
> > include_dir_config *conf =
> > (include_dir_config
> > *)ap_get_module_config(r->per_dir_config, &include_module); @@ -2688,8
> > +2699,7 @@
> > ctx->error_length = strlen(ctx->error_str);
> > }
> > else {
> > - ap_pass_brigade(f->next, b);
> > - return APR_ENOMEM;
> > + return ap_pass_brigade(f->next, b);
> > }
> > }
> > else {
> > @@ -2740,7 +2750,7 @@
> > */
> > apr_table_unset(f->r->headers_out, "Content-Length");
> >
> > - send_parsed_content(&b, r, f);
> > + rv = send_parsed_content(&b, r, f);
> >
> > if (parent) {
> > /* signify that the sub request should not be killed */
> > @@ -2748,7 +2758,7 @@
> > NESTED_INCLUDE_MAGIC);
> > }
> >
> > - return APR_SUCCESS;
> > + return rv;
> > }
> >
> > static void ap_register_include_handler(char *tag,
> > include_handler_fn_t *func)
--
_____________________________________________________________________________
Ryan Bloom rbb@apache.org
Covalent Technologies rbb@covalent.net
-----------------------------------------------------------------------------
Re: cvs commit: httpd-2.0/modules/filters mod_include.c
Posted by Bill Stoddard <st...@raleigh.ibm.com>.
Do you plan to handle the pass_brigade hidden in SPLIT_AND_PASS_PRETAG_BUCKETS()?
Bill
----- Original Message -----
From: <rb...@apache.org>
To: <ht...@apache.org>
Sent: Thursday, August 02, 2001 12:59 AM
Subject: cvs commit: httpd-2.0/modules/filters mod_include.c
> rbb 01/08/01 21:59:51
>
> Modified: . CHANGES
> modules/filters mod_include.c
> Log:
> Make the includes filter check return codes from filters lower in
> the filter chain. If a lower level filter returns an error, then
> the request needs to stop immediately. This allows mod_include to
> stop parsing data once a lower filter recognizes an error.
> PR: 8102
>
> Revision Changes Path
> 1.271 +6 -0 httpd-2.0/CHANGES
>
> Index: CHANGES
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/CHANGES,v
> retrieving revision 1.270
> retrieving revision 1.271
> diff -u -r1.270 -r1.271
> --- CHANGES 2001/08/02 04:25:19 1.270
> +++ CHANGES 2001/08/02 04:59:50 1.271
> @@ -1,5 +1,11 @@
> Changes with Apache 2.0.23-dev
>
> + *) Make the includes filter check return codes from filters lower in
> + the filter chain. If a lower level filter returns an error, then
> + the request needs to stop immediately. This allows mod_include to
> + stop parsing data once a lower filter recognizes an error.
> + [Ryan Bloom]
> +
> *) Add the ability to extend the methods that Apache understands
> and have those methods <limit>able in the httpd.conf. It uses
> the same bit mask/shifted offset as the original HTTP methods
>
>
>
> 1.117 +19 -9 httpd-2.0/modules/filters/mod_include.c
>
> Index: mod_include.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
> retrieving revision 1.116
> retrieving revision 1.117
> diff -u -r1.116 -r1.117
> --- mod_include.c 2001/07/26 16:37:56 1.116
> +++ mod_include.c 2001/08/02 04:59:51 1.117
> @@ -2319,14 +2319,15 @@
>
> /* -------------------------- The main function --------------------------- */
>
> -static void send_parsed_content(apr_bucket_brigade **bb, request_rec *r,
> - ap_filter_t *f)
> +static apr_status_t send_parsed_content(apr_bucket_brigade **bb,
> + request_rec *r, ap_filter_t *f)
> {
> include_ctx_t *ctx = f->ctx;
> apr_bucket *dptr = APR_BRIGADE_FIRST(*bb);
> apr_bucket *tmp_dptr;
> apr_bucket_brigade *tag_and_after;
> int ret;
> + apr_status_t rv;
>
> if (r->args) { /* add QUERY stuff to env cause it ain't yet */
> char *arg_copy = apr_pstrdup(r->pool, r->args);
> @@ -2384,7 +2385,10 @@
> else if ((tmp_dptr != NULL) && (ctx->bytes_parsed >=
BYTE_COUNT_THRESHOLD)) {
> /* Send the large chunk of pre-tag bytes... */
> tag_and_after = apr_brigade_split(*bb, tmp_dptr);
> - ap_pass_brigade(f->next, *bb);
> + rv = ap_pass_brigade(f->next, *bb);
> + if (rv != APR_SUCCESS) {
> + return rv;
> + }
> *bb = tag_and_after;
> dptr = tmp_dptr;
> ctx->bytes_parsed = 0;
> @@ -2572,7 +2576,10 @@
> } while (dptr != APR_BRIGADE_SENTINEL(*bb));
> }
> else { /* Otherwise pass it along... */
> - ap_pass_brigade(f->next, *bb); /* No SSI tags in this brigade... */
> + rv = ap_pass_brigade(f->next, *bb); /* No SSI tags in this brigade... */
> + if (rv != APR_SUCCESS) {
> + return rv;
> + }
> ctx->bytes_parsed = 0;
> }
> }
> @@ -2595,7 +2602,10 @@
> /* Set aside tag, pass pre-tag... */
> tag_and_after = apr_brigade_split(*bb, ctx->head_start_bucket);
> ap_save_brigade(f, &ctx->ssi_tag_brigade, &tag_and_after, r->pool);
> - ap_pass_brigade(f->next, *bb);
> + rv = ap_pass_brigade(f->next, *bb);
> + if (rv != APR_SUCCESS) {
> + return rv;
> + }
> ctx->bytes_parsed = 0;
> }
> }
> @@ -2661,6 +2671,7 @@
> request_rec *r = f->r;
> include_ctx_t *ctx = f->ctx;
> request_rec *parent;
> + apr_status_t rv;
> include_dir_config *conf =
> (include_dir_config *)ap_get_module_config(r->per_dir_config,
> &include_module);
> @@ -2688,8 +2699,7 @@
> ctx->error_length = strlen(ctx->error_str);
> }
> else {
> - ap_pass_brigade(f->next, b);
> - return APR_ENOMEM;
> + return ap_pass_brigade(f->next, b);
> }
> }
> else {
> @@ -2740,7 +2750,7 @@
> */
> apr_table_unset(f->r->headers_out, "Content-Length");
>
> - send_parsed_content(&b, r, f);
> + rv = send_parsed_content(&b, r, f);
>
> if (parent) {
> /* signify that the sub request should not be killed */
> @@ -2748,7 +2758,7 @@
> NESTED_INCLUDE_MAGIC);
> }
>
> - return APR_SUCCESS;
> + return rv;
> }
>
> static void ap_register_include_handler(char *tag, include_handler_fn_t *func)
>
>
>