Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] export variables from the log module

Maxim Dounin
September 30, 2012 02:56PM
Hello!

On Sun, Sep 30, 2012 at 07:55:49AM +0400, Vladimir Shebordaev wrote:

[...]

> +static ngx_int_t
> +ngx_http_log_add_variables(ngx_conf_t *cf)
> +{
> +    ngx_http_log_var_t *v;
> +    ngx_http_variable_t *var;
> +    ngx_http_core_main_conf_t *cmcf;
> +
> +    ngx_int_t rc;
> +
> +    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
> +    
> +    var = NULL;
> +
> +    for (v = ngx_http_log_vars; v->name.len; v++) {
> +
> +        if (var == NULL) {
> +            var = ngx_pcalloc(cf->pool, sizeof(ngx_http_variable_t));
> +            if (var == NULL) {
> +                return NGX_ERROR;
> +            }
> +        }
> +
> +        var->name = v->name;
> +        
> +        rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, var,
> +                              NGX_HASH_READONLY_KEY);
> +
> +        if (rc == NGX_BUSY) {
> +            continue;
> +        }

No, it's layering violation. It's not log modules business to
hack cmcf->variables_keys. And, as a side note, it's very-very
wrong to just continue on conflicting variable names.

I've already pointed out correct aproach to this: log module
not-really-variables should be reimplemented/duplicated as real
variables in ngx_http_variables.c.

[...]

Maxim Dounin

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

[PATCH] export variables from the log module

Vladimir Shebordaev 1103 September 29, 2012 11:58PM

Re: [PATCH] export variables from the log module

Vladimir Shebordaev 433 September 30, 2012 01:12AM

Re: [PATCH] export variables from the log module

Maxim Dounin 509 September 30, 2012 02:56PM

Re: [PATCH] export variables from the log module

Vladimir Shebordaev 504 September 30, 2012 07:04PM

Re: [PATCH] export variables from the log module Attachments

Benjamin Grössing 486 September 30, 2012 07:22PM

Re: [PATCH] export variables from the log module

Vladimir Shebordaev 631 September 30, 2012 07:48PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 278
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready