Welcome! Log In Create A New Profile

Advanced

Accessing subrequest output in memory

October 15, 2010 04:00PM
Hi,

I'm trying to get the output of an in-memory subrequest, but I can't
find where the output is stored.

Basically, I'm doing :

....
ngx_uint_t flags;
ngx_http_post_subrequest_t *psr;
ngx_str_t location;
ngx_str_t *url_args;

psr->handler = my_callback;
flags |= NGX_HTTP_SUBREQUEST_IN_MEMORY;

ngx_http_subrequest (r, &location, url_args, &sr, psr, flags);
....

// waiting for for subrequest to process

my_callback (ngx_http_request_t *sr, void *data, ngx_int_t rc)
{
ngx_http_request_t *r;

r = sr->parent;
...
// I want to be able to access the (body) output from the
subrequest here
}

If the subrequest uses an upstream, I know I can access the output using
sr->upstream->buffer. However, if the subrequest does not use
upstreams, then this won't work. The output is not available from
sr->out - r->out is set to NULL at some point during the output
filtering. As far as I can make out, what I need to do is find where
the body output ngx_chain_t * struct is saved after all the body
filtering has been processed, but I'm struggling to find it.

Can anyone tell me where it is, or where I can find the output?

Note : I don't want to remove the in-memory flag because I don't want
the output flushed to the client.

Thanks,

Marcus.

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

Accessing subrequest output in memory

Eugaia 2518 October 15, 2010 04:00PM

Re: Accessing subrequest output in memory

Eugaia 1125 October 15, 2010 08:46PM

Re: Accessing subrequest output in memory

Peter Leonov 1070 October 16, 2010 05:32AM

Re: Accessing subrequest output in memory

Eugaia 1427 October 16, 2010 10:52AM

Re: Accessing subrequest output in memory

Peter Leonov 1011 October 16, 2010 03:02PM

Re: Accessing subrequest output in memory

agentzh 1369 October 18, 2010 01:44AM



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

Online Users

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