March 16, 2010 07:20PM
1. I can set a handler to one of several "phases", like: "NGX_HTTP_REWRITE_PHASE", "NGX_HTTP_CONTENT_PHASE" and other. How to define an order the handlers will be called inside the same "phase"? Lets suppose i bond several handlers to some phase and what will be called first? If that order is depends on order of modules "loading", how to define that order of modules loading?

2. I developed a module that creates new variable "$z" during initialization. That variable can be used in configuration file. When nginx meets $z in configuration file, my handler is invoking (handler that returning the content of $z). If configuration file has three occurrences in the configuration file, my handler called 3 times. But i have a situation: the handler is calling 2 times per one variable. So it called 6 times for 3 occurrences of $z. Why? (that handler is called "get_handler").

3. OK. Lets suppose (2) is resolved. I want to create the content of $z once per request, but the "get_handler" can be invoked N times for the same request. Where i can set the content of $z between "get_handler" invocations for the same request?

4. I want to rewrite the ARGS from the request: i need to add "&z=1" to the end of args. For example: "a=1&b=1" ---> "a=1&b=2&z=1". But inside the handler i have access to ngx_http_request_t via pointer. And i have access to that ARGS via member "args" of the structure "ngx_http_request_t". That "args" member is a "ngx_str_t". How can i change its length? I tried to create a new string and rewrite old pointer (r -> args = new_str_ptr), but it is not working. Seems to be i have a copy of request during handler invocation and nginx killing that copy after request is processed?
Subject Author Posted

Modules programming. Several questions. $variables, URI rewriting.

mriadus March 16, 2010 07:20PM

Re: Modules programming. Several questions. $variables, URI rewriting.

Maxim Dounin March 17, 2010 06:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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