Subrequests again

Marat Dakota dakota at brokenpipe.ru
Thu Jul 18 23:05:08 UTC 2013


And now I've described the problem, it looks like I've found the reason of
my problem. I'll recheck it, but it looks like I'm incorrectly setting
subrequest's discard_body value.


On Fri, Jul 19, 2013 at 2:26 AM, Marat Dakota <dakota at brokenpipe.ru> wrote:

> Hi Yichun,
>
> It looks like it's not that simple.
>
> I've traced the source a bit, my post subrequest callback is called
> from ngx_http_finalize_request() and this ngx_http_finalize_request() is
> called from ngx_http_discarded_request_body_handler() like that (a piece of
> code from ngx_http_request_body.c):
>
>     if (rev->timedout) {
>         c->timedout = 1;
>         c->error = 1;
>         ngx_http_finalize_request(r, NGX_ERROR);
>         return;
>      }
>
> So, I have a timeout and c->error set to 1 and that
> means ngx_http_terminate_request().
>
> --
> Marat
>
>
> On Thu, Jul 18, 2013 at 3:28 AM, Yichun Zhang (agentzh) <agentzh at gmail.com
> > wrote:
>
>> Hello!
>>
>> On Wed, Jul 17, 2013 at 2:56 PM, Marat Dakota wrote:
>> > It looks like when a subrequest is completed with NGX_ERROR result (post
>> > subrequest callback is called with NGX_ERROR status) and I try
>> > ngx_http_output_filter for my main request after that,
>> > ngx_http_output_filter returns NGX_ERROR too.
>> >
>> > I need to be able to continue sending my main request body normally.
>> >
>> > How to achieve that?
>> >
>>
>> Easy. Just do not return NGX_ERROR in your post_subrequest handler
>> when the error is not fatal enough to abort the main request.
>> Otherwise, ngx_http_finalize_request will call
>> ngx_http_terminate_request.
>>
>> Regards,
>> -agentzh
>>
>> _______________________________________________
>> nginx-devel mailing list
>> nginx-devel at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20130719/5493e829/attachment.html>


More information about the nginx-devel mailing list