ngx_conf_set_str_array_slot() bug?

Valentin V. Bartenev vbart at nginx.com
Mon Aug 18 18:32:54 UTC 2014


On Monday 18 August 2014 18:04:26 Paulo Silva wrote:
> Hi,
> For a module with the following configuration
> 
> /**
>  * do_nothing_tuple "val1" "val2";
>  */
> static ngx_command_t  ngx_http_do_nothing_commands[] = {
> 
>     {
>         ngx_string("do_nothing_tuple"),
>         NGX_HTTP_LOC_CONF | NGX_CONF_TAKE2,
>         ngx_conf_set_str_array_slot,
>         NGX_HTTP_LOC_CONF_OFFSET,
>         offsetof(ngx_http_do_nothing_loc_conf_t, tuple),
>         NULL
>     },
> 
>     ngx_null_command
> };
> 
> I was expecting that ngx_conf_set_str_array_slot() would create and
> initialize an ngx_array_t with two elements (nelts ==  2), the given
> parameters, but it saves just the first element (see
> http://fossies.org/dox/nginx-1.7.4/ngx__conf__file_8c_source.html#l01034).
> 
> Is it a bug or ngx_conf_set_str_array_slot() use case is different?
> 
[..]

You may just look at the directives that use this function.
For example: http://nginx.org/r/proxy_hide_header

Typical configuration can be:

  proxy_hide_header X-Header-One;
  proxy_hide_header X-Header-Two;

And it will result array with two elements: "X-Header-One"
and "X-Header-Two".

  wbr, Valentin V. Bartenev



More information about the nginx-devel mailing list