From: André Malo Date: Fri, 22 Aug 2003 22:03:17 +0000 (+0000) Subject: cleanup handle_else and handle_endif functions X-Git-Tag: pre_ajp_proxy~1236 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=45eff7062f882a3516b4cd48a24027b9055a0fcd;p=apache cleanup handle_else and handle_endif functions git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101066 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index dcfca6be75..e91d5f7d45 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -2280,64 +2280,74 @@ static apr_status_t handle_elif(include_ctx_t *ctx, ap_filter_t *f, return APR_SUCCESS; } +/* + * + */ 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; } +/* + * + */ 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,