<div dir="ltr">Hi Yichun,<div><br></div><div>It looks like it's not that simple.</div><div><br></div><div>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):</div>
<div><br></div><div><div> if (rev->timedout) {</div><div> c->timedout = 1;</div><div> c->error = 1;<br></div><div> ngx_http_finalize_request(r, NGX_ERROR);</div><div> return;</div>
<div>
}</div></div><div><br></div><div>So, I have a timeout and c->error set to 1 and that means ngx_http_terminate_request().</div><div><br></div><div>--</div><div>Marat</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Jul 18, 2013 at 3:28 AM, Yichun Zhang (agentzh) <span dir="ltr"><<a href="mailto:agentzh@gmail.com" target="_blank">agentzh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello!<br>
<div><div class="h5"><br>
On Wed, Jul 17, 2013 at 2:56 PM, Marat Dakota wrote:<br>
> It looks like when a subrequest is completed with NGX_ERROR result (post<br>
> subrequest callback is called with NGX_ERROR status) and I try<br>
> ngx_http_output_filter for my main request after that,<br>
> ngx_http_output_filter returns NGX_ERROR too.<br>
><br>
> I need to be able to continue sending my main request body normally.<br>
><br>
> How to achieve that?<br>
><br>
<br>
</div></div>Easy. Just do not return NGX_ERROR in your post_subrequest handler<br>
when the error is not fatal enough to abort the main request.<br>
Otherwise, ngx_http_finalize_request will call<br>
ngx_http_terminate_request.<br>
<br>
Regards,<br>
-agentzh<br>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</blockquote></div><br></div>