Welcome! Log In Create A New Profile


ngx_Postgres + Eval (agentzh version)

August 15, 2011 02:19PM

I have this piece of configuration that is almost copy+pasted from the ngx_postgres example but that for some unknown reason to me is not working.
The value of the $s variable is always empty ou NULL if I use postgres_escape.

location ~ '^/foo/([a-zA-Z0-9\-\.]+)/(.*)$' {
set $sid $1;
set $url $2 ;

eval_subrequest_in_memory off;
eval_override_content_type text/plain;
eval_buffer_size 1k;

eval $isValid {
postgres_escape $s $sid;
postgres_query "SELECT session_id FROM server_sessions WHERE session_id = $s LIMIT 1";

postgres_pass pg_database;
postgres_output value ;

#echo -n "foo:-> sid = "; echo $sid;
#echo -n "foo: -> url = "; echo $url;
#echo -n "isValid = ["; echo $isValid; echo "]";


With this comand

curl http://istreamer/foo/s9/4554354aseee4/opopo

(and without the # obviously) I get

foo:-> sid = s9
foo: -> url = 4554354aseee4/opopo
isValid = []

and the query get's logged as

SELECT session_id FROM server_sessions WHERE session_id = NULL LIMIT 1

in the Postgres log meaning that $s has no value.

Can someone explain me what I'm doing wrong? This is supposed to be quite simple....

Subject Author Posted

ngx_Postgres + Eval (agentzh version)

ainou August 15, 2011 02:19PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

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