yOn Wed, 9 Jul 2003, Ron Park wrote:
> This problem revolves around the use of 'if' 'else' and 'elseif'.
> Originally, we thought the problem was related to <!--#else -->
> but later we found an troublesome <!--#if ... --> that lead to
> us finding the real culprit.
Andre and I counter-propose the following patch for this problem. Can you
please test it on your test cases?
Also note that there's that one line at the bottom that sets
ctx->bytes_parsed=0, and we weren't sure if it should go inside or outside
that if(). Comments?
Thanks,
Cliff
Index: mod_include.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
retrieving revision 1.233
diff -u -d -r1.233 mod_include.c
--- mod_include.c 3 Feb 2003 17:53:01 -0000 1.233
+++ mod_include.c 10 Jul 2003 02:24:25 -0000
@@ -2956,7 +2956,7 @@
/* If I am inside a conditional (if, elif, else) that is false
* then I need to throw away anything contained in it.
*/
- if ((!(ctx->flags & FLAG_PRINTING)) && (tmp_dptr != NULL) &&
+ if ((!(ctx->flags & FLAG_PRINTING)) &&
(dptr != APR_BRIGADE_SENTINEL(*bb))) {
while ((dptr != APR_BRIGADE_SENTINEL(*bb)) &&
(dptr != tmp_dptr)) {
@@ -3197,25 +3197,16 @@
* once the whole tag has been found.
*/
if (ctx->state == PRE_HEAD) {
- /* Inside a false conditional (if, elif, else), so toss it all... */
- if ((dptr != APR_BRIGADE_SENTINEL(*bb)) &&
- (!(ctx->flags & FLAG_PRINTING))) {
- apr_bucket *free_bucket;
- do {
- free_bucket = dptr;
- dptr = APR_BUCKET_NEXT (dptr);
- apr_bucket_delete(free_bucket);
- } while (dptr != APR_BRIGADE_SENTINEL(*bb));
- }
- else {
- /* Otherwise pass it along...
+ if (!APR_BRIGADE_EMPTY(*bb)) {
+ /* Pass it along...
* No SSI tags in this brigade... */
rv = ap_pass_brigade(f->next, *bb);
if (rv != APR_SUCCESS) {
return rv;
}
- ctx->bytes_parsed = 0;
}
+ /* XXX: should this line go inside the if(!empty)? */
+ ctx->bytes_parsed = 0;
}
else if (ctx->state == PARSED) { /* Invalid internal condition... */
apr_bucket *content_head = NULL, *tmp_bkt;