httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: svn commit: r1601877 - /httpd/httpd/trunk/modules/filters/mod_sed.c
Date Thu, 12 Jun 2014 07:13:30 GMT


ylavic@apache.org wrote:
> Author: ylavic
> Date: Wed Jun 11 12:50:29 2014
> New Revision: 1601877
> 
> URL: http://svn.apache.org/r1601877
> Log:
> mod_sed: Reuse ctx->bb in sed_response_filter() and be safe with its
> reentrance. The single return point helps to not duplicate cleanup code.
> 
> Modified:
>     httpd/httpd/trunk/modules/filters/mod_sed.c
> 
> Modified: httpd/httpd/trunk/modules/filters/mod_sed.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_sed.c?rev=1601877&r1=1601876&r2=1601877&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/filters/mod_sed.c (original)
> +++ httpd/httpd/trunk/modules/filters/mod_sed.c Wed Jun 11 12:50:29 2014

> @@ -351,20 +349,19 @@ static apr_status_t sed_response_filter(
>                      status = sed_eval_buffer(&ctx->eval, buf, bytes, ctx);
>                  }
>                  if (status != APR_SUCCESS) {
> -                    clear_ctxpool(ctx);
> -                    return status;
> +                    break;
>                  }
>              }
>              apr_bucket_delete(b);
>          }
>      }
> -    status = flush_output_buffer(ctx);
> -    if (status != APR_SUCCESS) {
> -        clear_ctxpool(ctx);
> -        return status;
> +    if (status == APR_SUCCESS) {
> +        status = flush_output_buffer(ctx);
>      }
>      if (!APR_BRIGADE_EMPTY(ctx->bb)) {
> -        status = ap_pass_brigade(f->next, ctx->bb);
> +        if (status == APR_SUCCESS) {
> +            status = ap_pass_brigade(f->next, ctx->bb);
> +        }
>          apr_brigade_cleanup(ctx->bb);
>      }
>      clear_ctxpool(ctx);
> 
> 
> 

We have a small change in logic here. Maybe it makes sense. Previously we did not cleanup
ctx->bb if flush_output_buffer
returned != APR_SUCCESS. Now we do (only if not empty of course).

Regards

RĂ¼diger

Mime
View raw message