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 4371 July 29, 2010 04:12AM

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

Piotr Sikora 1270 July 29, 2010 05:46AM

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

Mirko Dziadzka 1197 July 29, 2010 07:06AM

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

agentzh 1971 August 04, 2010 10:28PM

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

Mirko Dziadzka 1326 July 29, 2010 10:04AM



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

Online Users

Guests: 156
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready