architecture of a module - processing a response from a subrequest
mirko.dziadzka at gmail.com
Thu Jul 29 18:02:59 MSD 2010
Piotr Sikora wrote:
>> Question: What is the recommended way to read and process the response
>> body of a sub request which shouldn't go to the client? Should I use a
>> body-filter or can I access the response body from my post-subrequest
>> handler. I tried the later but it does not work. Any example code?
> Check eval module .
Thanks. I missed the NGX_HTTP_SUBREQUEST_IN_MEMORY flag in my first
What I don't understand: If I don't set NGX_HTTP_SUBREQUEST_IN_MEMORY,
then the response from the subrequest will be forwarded to the browser,
if I set NGX_HTTP_SUBREQUEST_IN_MEMORY flag, it will not. Is this the
supposed behavior or only a side effect.
A second question: I get the content of the response via
ctx->response.len = r->upstream->buffer.last -
ctx->response.data = r->upstream->buffer.pos;
Question: Will this buffer be available until the end of the main
request or do I have to make a copy here?
More information about the nginx-devel