Welcome! Log In Create A New Profile

Advanced

Re: Subrequests from body filters

Maxim Dounin
March 25, 2013 10:22AM
Hello!

On Mon, Mar 25, 2013 at 05:52:53PM +0400, Marat Dakota wrote:

> >> But is it ok to call next body filter in subrequest's body filter to
> >> produce output to main request?
> >> I mean ngx_http_next_body_filter(r->main, out).
> >
> > No. You should call next body filter of the request you are
> > working with. It's postpone filter responsibility to manage
> > subrequests output, and if you try to do this yourself instead -
> > result will be undefined.
>
> It seems to work as expected for me. How can I cause problems with this?

Undefined behaviour sometimes appear to work as expected. This
doesn't mean it's correct though.

Depending on the exact place in a filter chain where you did it
and various other factors like timings, results may vary from
"nothing bad might happen, as r == r->main anyway" to "response
will completely incorrect as wrong filters will be applied to the
response body".

Most trivial thing to test is probably a subrequest order, which
likely will be wrong in your case if first subrequest will take
longer to handle than second one.

--
Maxim Dounin
http://nginx.org/en/donation.html

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

Subrequests from body filters

Marat Dakota 977 March 24, 2013 01:14PM

Re: Subrequests from body filters

Marat Dakota 447 March 24, 2013 05:16PM

Re: Subrequests from body filters

Marat Dakota 552 March 24, 2013 05:40PM

Re: Subrequests from body filters

Maxim Dounin 502 March 25, 2013 07:58AM

Re: Subrequests from body filters

Marat Dakota 469 March 25, 2013 09:42AM

Re: Subrequests from body filters

Maxim Dounin 440 March 25, 2013 09:48AM

Re: Subrequests from body filters

Marat Dakota 456 March 25, 2013 09:54AM

Re: Subrequests from body filters

Maxim Dounin 457 March 25, 2013 10:22AM

Re: Subrequests from body filters

Marat Dakota 406 March 25, 2013 10:48AM

Re: Subrequests from body filters

Maxim Dounin 481 March 25, 2013 10:56AM

Re: Subrequests from body filters

Marat Dakota 464 March 25, 2013 11:42AM

Re: Subrequests from body filters

Maxim Dounin 407 March 25, 2013 12:02PM

Re: Subrequests from body filters

Marat Dakota 447 March 25, 2013 12:24PM

Re: Subrequests from body filters

Maxim Dounin 650 March 25, 2013 02:12PM



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

Online Users

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