Welcome! Log In Create A New Profile

Advanced

Re: Problem with post_action when used with return 202; and POST request

Maxim Dounin
August 12, 2011 03:48AM
Hello!

On Thu, Aug 11, 2011 at 02:38:44PM +0300, Pyry Hakulinen wrote:

> > Thank you for your report.  Please try the attached patch.
>
> Thank you, the patch appears to be working fine, but because it
> discards the request body, it isn't going to work for our use case.
>
> Our use case is, to POST data to nginx and let nginx asynchronously
> proxy it to somewhere else for processing, while freeing the client
> that did the POSTing to do other things.
>
> I think the request body should be transferred to post_action
> location, and the location can then decide if it needs it or not.
> Attached is a patch against 1.0.5 that reads the body if post_action
> is used, but I'm not really sure if it's correct. My nginx-fu is still
> a bit lacking.

No, this is incorrect. Body should be either read or discarded
before response could be returned (else communication with clients
which write body and only then read response will just deadlock).
And it's up to code returning response to decide whether it needs
body or not, post_action has nothing to do with it. (I personally
consider post_action to be a dirty hack which should be removed
entirely, and it's not officially documented on purpose, but
that's another story.)

In you particular case I would recommend actually using module to
read body and return 202 response instead of using "return 202".

Maxim Dounin

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

Problem with post_action when used with return 202; and POST request

Pyry Hakulinen August 10, 2011 07:24AM

Re: Problem with post_action when used with return 202; and POST request

Maxim Dounin August 10, 2011 07:12PM

Re: Problem with post_action when used with return 202; and POST request

Pyry Hakulinen August 11, 2011 07:40AM

Re: Problem with post_action when used with return 202; and POST request

Maxim Dounin August 12, 2011 03:48AM

Re: Problem with post_action when used with return 202; and POST request

Pyry Hakulinen August 13, 2011 04:08PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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