[PATCH] Headers filter: style

Maxim Dounin mdounin at mdounin.ru
Thu Jun 23 12:31:16 UTC 2016


Hello!

On Wed, Jun 22, 2016 at 01:53:11PM -0700, Piotr Sikora wrote:

> # HG changeset patch
> # User Piotr Sikora <piotrsikora at google.com>
> # Date 1466628475 25200
> #      Wed Jun 22 13:47:55 2016 -0700
> # Node ID 0419e0ead3d63b8d96f59fc3c74b36bf9f3fe188
> # Parent  191e23214dfbaf01255d421f5bbe0d5541d03a2f
> Headers filter: style.
> 
> Signed-off-by: Piotr Sikora <piotrsikora at google.com>
> 
> diff -r 191e23214dfb -r 0419e0ead3d6 src/http/modules/ngx_http_headers_filter_module.c
> --- a/src/http/modules/ngx_http_headers_filter_module.c
> +++ b/src/http/modules/ngx_http_headers_filter_module.c
> @@ -151,7 +151,7 @@ ngx_http_headers_filter(ngx_http_request
>  {
>      ngx_str_t                 value;
>      ngx_uint_t                i, safe_status;
> -    ngx_http_header_val_t    *h;
> +    ngx_http_header_val_t    *hv;
>      ngx_http_headers_conf_t  *conf;
>  
>      conf = ngx_http_get_module_loc_conf(r, ngx_http_headers_filter_module);
> @@ -188,18 +188,18 @@ ngx_http_headers_filter(ngx_http_request
>      }
>  
>      if (conf->headers) {
> -        h = conf->headers->elts;
> +        hv = conf->headers->elts;
>          for (i = 0; i < conf->headers->nelts; i++) {
>  
> -            if (!safe_status && !h[i].always) {
> +            if (!safe_status && !hv[i].always) {
>                  continue;
>              }
>  
> -            if (ngx_http_complex_value(r, &h[i].value, &value) != NGX_OK) {
> +            if (ngx_http_complex_value(r, &hv[i].value, &value) != NGX_OK) {
>                  return NGX_ERROR;
>              }
>  
> -            if (h[i].handler(r, &h[i], &value) != NGX_OK) {
> +            if (hv[i].handler(r, &hv[i], &value) != NGX_OK) {
>                  return NGX_ERROR;
>              }
>          }

I would rather not.  The "hv" is used to refer to a particular 
ngx_http_header_val_t, while "h" here is an array of elements.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list