Welcome! Log In Create A New Profile

Advanced

Re: architecture of a module - processing a response from a subrequest

Mirko Dziadzka
July 29, 2010 10:04AM
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 [1].

Thanks. I missed the NGX_HTTP_SUBREQUEST_IN_MEMORY flag in my first
implementation.

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

if (r->upstream)
{
ctx->response.len = r->upstream->buffer.last -
r->upstream->buffer.pos;
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?


Regards

Mirko


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

architecture of a module - processing a response from a subrequest

Mirko Dziadzka 3802 July 29, 2010 04:12AM

Re: architecture of a module - processing a response from a subrequest

Piotr Sikora 937 July 29, 2010 05:46AM

Re: architecture of a module - processing a response from a subrequest

Mirko Dziadzka 904 July 29, 2010 07:06AM

Re: architecture of a module - processing a response from a subrequest

agentzh 1664 August 04, 2010 10:28PM

Re: architecture of a module - processing a response from a subrequest

Mirko Dziadzka 967 July 29, 2010 10:04AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

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