httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Fritsch ...@sfritsch.de>
Subject Re: svn commit: r1205423 - in /httpd/httpd/trunk/modules: cache/mod_cache.c mappers/mod_negotiation.c
Date Wed, 23 Nov 2011 20:13:06 GMT
On Wed, 23 Nov 2011, jim@apache.org wrote:

> Author: jim
> Date: Wed Nov 23 15:01:42 2011
> New Revision: 1205423
>
> URL: http://svn.apache.org/viewvc?rev=1205423&view=rev
> Log:
> Use ap_pass_brigade_fchk()
>
> Modified:
>    httpd/httpd/trunk/modules/cache/mod_cache.c
>    httpd/httpd/trunk/modules/mappers/mod_negotiation.c
>
> Modified: httpd/httpd/trunk/modules/cache/mod_cache.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=1205423&r1=1205422&r2=1205423&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/cache/mod_cache.c (original)
> +++ httpd/httpd/trunk/modules/cache/mod_cache.c Wed Nov 23 15:01:42 2011
> @@ -292,19 +292,11 @@ static int cache_quick_handler(request_r
>     out = apr_brigade_create(r->pool, r->connection->bucket_alloc);
>     e = apr_bucket_eos_create(out->bucket_alloc);
>     APR_BRIGADE_INSERT_TAIL(out, e);
> -    rv = ap_pass_brigade(r->output_filters, out);
> -    if (rv != APR_SUCCESS) {
> -        if (rv != AP_FILTER_ERROR) {
> -            /* no way to know what type of error occurred */
> -            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
> -                          "cache_quick_handler(%s): ap_pass_brigade returned %i",
> -                          cache->provider_name, rv);
> -            return HTTP_INTERNAL_SERVER_ERROR;
> -        }
> -        return rv;
> -    }
>
> -    return OK;
> +    return ap_pass_brigade_fchk(r, out,
> +                                apr_psprintf(r->pool,
> +                                             "cache_quick_handler(%s): ap_pass_brigade
returned",
> +                                             cache->provider_name));
> }

This means we call apr_psprintf even if everything went well. That's far 
from optimal. Maybe really make it into a macro, then the apr_psprintf 
would only be executed on error?

>
> /**
> @@ -576,19 +568,10 @@ static int cache_handler(request_rec *r)
>     out = apr_brigade_create(r->pool, r->connection->bucket_alloc);
>     e = apr_bucket_eos_create(out->bucket_alloc);
>     APR_BRIGADE_INSERT_TAIL(out, e);
> -    rv = ap_pass_brigade(r->output_filters, out);
> -    if (rv != APR_SUCCESS) {
> -        if (rv != AP_FILTER_ERROR) {
> -            /* no way to know what type of error occurred */
> -            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
> -                          "cache_handler(%s): ap_pass_brigade returned %i",
> -                          cache->provider_name, rv);
> -            return HTTP_INTERNAL_SERVER_ERROR;
> -        }
> -        return rv;
> -    }
> -
> -    return OK;
> +    return ap_pass_brigade_fchk(r, out,
> +                                apr_psprintf(r->pool,
> +                                             "cache(%s): ap_pass_brigade returned",
> +                                             cache->provider_name));
> }

Same as above

Mime
View raw message