ngx_conf_set_str_array_slot() bug?

Paulo Silva pauloasilva at gmail.com
Mon Aug 18 23:39:29 UTC 2014


Great.

I was looking for some modules that use this handler (thanks to grep)
but it is not an easy task when we do not have an example of the
configuration.

Thanks a bunch,

On Mon, Aug 18, 2014 at 7:32 PM, Valentin V. Bartenev <vbart at nginx.com> wrote:
> 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
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel



-- 
Paulo A. Silva
http://tech.pauloasilva.com
http://linkedin.com/in/devpauloasilva/



More information about the nginx-devel mailing list