Welcome! Log In Create A New Profile

Advanced

Module vars set inside if's are not set

Mark Maunder
November 23, 2009 11:46PM
Variables that are used by modules and are set inside 'if' blocks in the
nginx.conf file are not being set correctly. My nginx version (-V
output) is:

nginx version: nginx/0.7.64
built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module
--add-module=../nginx_http_push_module-0.69
--add-module=../agentzh-echo-nginx-module-b8a0849


I'm setting $push_channel_id for the nginx_http_push_module using the
following if statement.

location ^~ /fjsub/ {

push_subscriber long-poll;
if ($arg_id) {
set $push_channel_id $arg_id;
}

}

The variable is set fine outside an 'if' statement but when the if
evaluates to true, the variable is not set.

I have duplicated this behaviour with the echo module as follows:

This will print "No":

location ^~ /echo/ {
set $myText "No";
if ($remote_addr ~* '000'){
set $myText "Yes";
}
echo $myText;
}


But when I replace '000' with '64' which matches my IP address, nginx
returns a 404 because the value of $myText is empty which means the echo
command didn't have any effect.

I have duplicated this behavior with only the echo module compiled in
and ssl and push removed.

I've already filed this as a bug on GIT for the NHPM (push) module but I
suspect this may be an nginx bug since it is broken across modules.

This bug also exists on the latest development build:

nginx version: nginx/0.8.28
built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
configure arguments: --prefix=/usr/local/nginx
--add-module=../agentzh-echo-nginx-module-b8a0849

What is surprising/confusing is that I'm setting variables inside
conditional statements that are used by proxy_pass and that works fine.
So does the upstream module (proxy_pass module) handle it's variables
differently to the echo and push modules?

Thanks,

Mark.

--
--
Mark Maunder <mark@feedjit.com>
http://feedjit.com/


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

Module vars set inside if's are not set

Mark Maunder November 23, 2009 11:46PM

Re: Module vars set inside if's are not set

Igor Sysoev November 24, 2009 04:06PM

Re: Module vars set inside if's are not set

Mark Maunder November 24, 2009 05:28PM

Re: Module vars set inside if's are not set

agentzh November 24, 2009 09:40PM

Re: Module vars set inside if's are not set

Mark Maunder November 24, 2009 09:54PM

Re: Module vars set inside if's are not set

agentzh November 24, 2009 09:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 53
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