httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/filters mod_include.c
Date Fri, 22 Aug 2003 22:03:17 GMT
nd          2003/08/22 15:03:17

  Modified:    modules/filters mod_include.c
  Log:
  cleanup handle_else and handle_endif functions
  
  Revision  Changes    Path
  1.248     +48 -38    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.247
  retrieving revision 1.248
  diff -u -r1.247 -r1.248
  --- mod_include.c	22 Aug 2003 21:46:00 -0000	1.247
  +++ mod_include.c	22 Aug 2003 22:03:17 -0000	1.248
  @@ -2280,64 +2280,74 @@
       return APR_SUCCESS;
   }
   
  +/*
  + * <!--#else -->
  + */
   static apr_status_t handle_else(include_ctx_t *ctx, ap_filter_t *f,
                                   apr_bucket_brigade *bb)
   {
  -    char *tag = NULL;
  -    char *tag_val = NULL;
       request_rec *r = f->r;
   
  -    if (!ctx->if_nesting_level) {
  -        ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, SSI_VALUE_RAW);
  -        if (tag || tag_val) {
  -            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  -                        "else directive does not take tags in %s", r->filename);
  -            if (ctx->flags & SSI_FLAG_PRINTING) {
  -                SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
  -            }
  -            return APR_SUCCESS;
  +    if (ctx->argc) {
  +        ap_log_rerror(APLOG_MARK,
  +                      (!(ctx->if_nesting_level)) ? APLOG_ERR : APLOG_WARNING,
  +                      0, r, "else directive does not take tags in %s",
  +                      r->filename);
  +    }
  +
  +    if (ctx->if_nesting_level) {
  +        return APR_SUCCESS;
  +    }
  +
  +    if (ctx->argc) {
  +        if (ctx->flags & SSI_FLAG_PRINTING) {
  +            SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
           }
  -        else {
  -            LOG_COND_STATUS(ctx, f, bb, " else");
  +
  +        return APR_SUCCESS;
  +    }
  +
  +    LOG_COND_STATUS(ctx, f, bb, " else");
               
  -            if (ctx->flags & SSI_FLAG_COND_TRUE) {
  -                ctx->flags &= SSI_FLAG_CLEAR_PRINTING;
  -            }
  -            else {
  -                ctx->flags |= (SSI_FLAG_PRINTING | SSI_FLAG_COND_TRUE);
  -            }
  -            return APR_SUCCESS;
  -        }
  +    if (ctx->flags & SSI_FLAG_COND_TRUE) {
  +        ctx->flags &= SSI_FLAG_CLEAR_PRINTING;
  +    }
  +    else {
  +        ctx->flags |= (SSI_FLAG_PRINTING | SSI_FLAG_COND_TRUE);
       }
   
       return APR_SUCCESS;
   }
   
  +/*
  + * <!--#endif -->
  + */
   static apr_status_t handle_endif(include_ctx_t *ctx, ap_filter_t *f,
                                    apr_bucket_brigade *bb)
   {
  -    char *tag     = NULL;
  -    char *tag_val = NULL;
       request_rec *r = f->r;
   
  -    if (!ctx->if_nesting_level) {
  -        ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, SSI_VALUE_RAW);
  -        if (tag || tag_val) {
  -            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  -                       "endif directive does not take tags in %s", r->filename);
  -            SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
  -            return APR_SUCCESS;
  -        }
  -        else {
  -            LOG_COND_STATUS(ctx, f, bb, "endif");
  -            ctx->flags |= (SSI_FLAG_PRINTING | SSI_FLAG_COND_TRUE);
  -            return APR_SUCCESS;
  -        }
  +    if (ctx->argc) {
  +        ap_log_rerror(APLOG_MARK,
  +                      (!(ctx->if_nesting_level)) ? APLOG_ERR : APLOG_WARNING,
  +                      0, r, "endif directive does not take tags in %s",
  +                      r->filename);
       }
  -    else {
  -        ctx->if_nesting_level--;
  +
  +    if (ctx->if_nesting_level) {
  +        --(ctx->if_nesting_level);
           return APR_SUCCESS;
       }
  +
  +    if (ctx->argc) {
  +        SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
  +        return APR_SUCCESS;
  +    }
  +
  +    LOG_COND_STATUS(ctx, f, bb, "endif");
  +    ctx->flags |= (SSI_FLAG_PRINTING | SSI_FLAG_COND_TRUE);
  +
  +    return APR_SUCCESS;
   }
   
   static apr_status_t handle_set(include_ctx_t *ctx, ap_filter_t *f,
  
  
  

Mime
View raw message