Welcome! Log In Create A New Profile

Advanced

ngx_conf_t args count

Jeffrey Walton
December 18, 2013 07:50AM
From Miller's http://www.evanmiller.org/nginx-modules-guide.html, section 5.2:

ngx_http_upstream_hash(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_upstream_srv_conf_t *uscf;
ngx_http_script_compile_t sc;
ngx_str_t *value;
ngx_array_t *vars_lengths, *vars_values;

value = cf->args->elts;

/* the following is necessary to evaluate the argument to "hash"
as a $variable */
ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));

vars_lengths = NULL;
vars_values = NULL;

sc.cf = cf;
sc.source = &value[1];
...
}

How does one know that value[1] is valid? Shouldn't cf->args->nelts be
checked first? Or does ngx_conf_t always have at least two options?

Related: why was value[0] not chosen?

Jeff

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

ngx_conf_t args count

Jeffrey Walton December 18, 2013 07:50AM

Re: ngx_conf_t args count

Jeffrey Walton December 18, 2013 07:54AM

Re: ngx_conf_t args count

Ruslan Ermilov December 18, 2013 07:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 51
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready