[dev] http phase handler

Manlio Perillo manlio_perillo at libero.it
Wed Dec 5 22:27:56 MSK 2007


Igor Sysoev ha scritto:
> [...]
>>> In the context phase there may run a single defined content handler (perl,
>>> proxy_pass, fastcgi_pass, memcached_pass, flv, empty_gif) or stack
>>> of handlers: index, autoindex, dav, static.
>>>
>>> If a defined handler calls finally ngx_http_finalize_request(NGX_DECLINED),
>>> then nginx goes to the stack of handlers. Now only perl can do this.
>>>
>> Ok.
>> This should be possible with Python, too.
>> But I can't see an useful application for this.
> 
> For example, perl may handle POSTs and decline other to default stack.
> 

What happens if the perl handler sends the headers and writes some data?


> [...]
>>
>> Is it possible to return NGX_DONE/NGX_AGAIN from the access phase 
>> handler and then call ngx_http_finalize_request(NGX_HTTP_...) when the 
>> handler is done (as an example it may setup the events when doing an 
>> asynchronous query to a database)?
> 
> Yes. However, I could not say right how you should finalize processing
> after second call: ngx_http_finalize_request() or return.
> 

I will try to do some tests.

>> The only module with a phase handler that does "interesting" things is 
>> the autoindex module, but it uses sub requests (and I have yet to 
>> understand how they works :)).
> 
> The stock autoindex module does not use subrequests.
> 

Oh, right!



Thanks  Manlio Perillo





More information about the nginx mailing list