httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/modules/filters mod_include.c
Date Thu, 20 Jun 2002 02:59:25 GMT
brianp      2002/06/19 19:59:25

  Modified:    modules/filters mod_include.c
  Log:
  Cleaner handling of unterminated SSI directives
  
  Revision  Changes    Path
  1.228     +26 -2     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.227
  retrieving revision 1.228
  diff -u -r1.227 -r1.228
  --- mod_include.c	19 Jun 2002 07:21:45 -0000	1.227
  +++ mod_include.c	20 Jun 2002 02:59:25 -0000	1.228
  @@ -3230,6 +3230,7 @@
               APR_BRIGADE_CONCAT(ctx->ssi_tag_brigade, *bb);
           }
           else {                  /* End of brigade contains part of SSI tag... */
  +            apr_bucket *last;
               if (ctx->head_start_index > 0) {
                   apr_bucket_split(ctx->head_start_bucket, ctx->head_start_index);
                   ctx->head_start_bucket = 
  @@ -3238,7 +3239,30 @@
               }
                              /* 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);
  +            rv = ap_pass_brigade(f->next, *bb);
  +            /* Set aside the partial tag
  +             * Exception: if there's an EOS at the end of this brigade,
  +             * the tag will never be completed, so send an error and EOS
  +             */
  +            last = APR_BRIGADE_LAST(tag_and_after);
  +            if (APR_BUCKET_IS_EOS(last)) {
  +                /* Remove everything before the EOS (i.e., the partial tag)
  +                 * and replace it with an error msg */
  +                apr_bucket *b;
  +                apr_bucket *err_bucket = NULL;
  +                for (b = APR_BRIGADE_FIRST(tag_and_after);
  +                     !APR_BUCKET_IS_EOS(b);
  +                     b = APR_BRIGADE_FIRST(tag_and_after)) {
  +                    APR_BUCKET_REMOVE(b);
  +                    apr_bucket_destroy(b);
  +                }
  +                CREATE_ERROR_BUCKET(ctx, err_bucket, b, err_bucket);
  +                ap_pass_brigade(f->next, tag_and_after);
  +            }
  +            else {
  +                ap_save_brigade(f, &ctx->ssi_tag_brigade,
  +                                &tag_and_after, r->pool);
  +            }
               if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(ctx->ssi_tag_brigade))) {
                   apr_bucket *new_eos;
                   /* Make sure there's no EOS at the end of the set-aside
  @@ -3253,7 +3277,7 @@
                   new_eos = apr_bucket_eos_create((*bb)->bucket_alloc);
                   APR_BRIGADE_INSERT_TAIL(*bb, new_eos);
               }
  -            rv = ap_pass_brigade(f->next, *bb);
  +
               if (rv != APR_SUCCESS) {
                   return rv;
               }
  
  
  

Mime
View raw message