Welcome! Log In Create A New Profile

Advanced

Re: Subrequests and output filters

Maxim Dounin
August 05, 2015 02:56PM
Hello!

On Wed, Aug 05, 2015 at 11:21:52AM +0000, Maxime Henrion wrote:

[...]

> NOTE: I'm not sure whether NGX_DONE above is the correct enum
> value to use, but I have tried NGX_AGAIN and others as well to
> no avail.

NGX_DONE is correct return code. Compare with proxy and/or dav
modules code if unsure.

[...]

> As of right now, I have simply never been able to get ateven a
> response body for one of those subrequests. I have verified that
> the subrequests are indeed being sent, and that nginx reads the
> response to completion (using netcat and sending an invalid
> response prompts a log message about an invalid HTTP response),
> but my output body filter is simply never being invoked, and as
> far as I know this is the only way I have to get at the response
> body here. I have not been able to use the post_subrequest
> callback either, and am unsure if it'd be useful in my case.

So, the problem you are facing now is that your body filter is not
called, right? Most likely reason, I think, is that your module
is registered at a wrong place during configuration, and that's
why it's not being called. To make sure your filter is called you
should register it at HTTP_AUX_FILTER_MODULES list in the config
file of your module.

Alternatively, you may consider using the
NGX_HTTP_SUBREQUEST_IN_MEMORY flag to ngx_http_subrequest().
This will allow you to get a response body in a post subrequest
callback, without writing any response body filters. See
src/http/modules/ngx_http_ssi_filter_module.c for a usage example,
it's used to implement the "set" parameter of the "include" SSI
command (see http://nginx.org/en/docs/http/ngx_http_ssi_module.html
for docs).

--
Maxim Dounin
http://nginx.org/

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

Subrequests and output filters

Maxime Henrion 689 August 05, 2015 07:24AM

Re: Subrequests and output filters

Yichun Zhang (agentzh) 282 August 05, 2015 11:20AM

Re: Subrequests and output filters

Maxim Dounin 318 August 05, 2015 02:56PM

RE: Subrequests and output filters

Maxime Henrion 356 August 07, 2015 07:34AM

Re: Subrequests and output filters

Maxim Dounin 300 August 07, 2015 02:02PM

RE: Subrequests and output filters

Maxime Henrion 275 August 07, 2015 02:24PM

Re: Subrequests and output filters

Maxim Dounin 317 August 07, 2015 05:48PM



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

Online Users

Guests: 73
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready