How to abort subrequest properly?
ngx.eugaia at gmail.com
Thu Jul 4 00:37:58 UTC 2013
El 03/07/13 20:59, Marcus Clyne escribió:
> El 03/07/13 08:54, Maxim Dounin escribió:
>> On Wed, Jul 03, 2013 at 04:34:26AM +0400, Marat Dakota wrote:
>>> Nobody knows?
>>> On Sun, Jun 30, 2013 at 3:04 PM, Marat Dakota <dakota at brokenpipe.ru>
>>>> I am parsing a subrequest's body as it arrives. At some point I could
>>>> decide that the subrequest's body is not well-formed. I want to stop
>>>> receiving the rest of the subrequest's body and close its
>>>> connection. My
>>>> main request and all other subrequests should continue working.
>>>> I've tried something like ngx_http_finalize_request(sr, NGX_ABORT). It
>>>> looks like it's not the thing.
>>>> What steps should be applied to abort a subrequest?
>> As of now, it's not really possible to abort a subrequest without
>> aborting main request.
> If the subrequest uses the upstream mechanism, wouldn't it be safe to
> just close the socket of upstream's connection? I'm assuming there
> would be an entry in the error log, but is there anything harmful that
> could come from it?
And you'd obviously want to finalize the subrequest, probably do
something like ngx_http_finalize_request(sr, NGX_OK). I don't think you
could just issue this on its own, since I think the subrequest's sockets
wouldn't automatically be closed until the main request was finalized
(but it's been a while since I've done core hacking, and I can't
remember for sure).
More information about the nginx-devel