Welcome! Log In Create A New Profile

Advanced

Subrequest using Parent Request Body

Matthieu Tourne
May 07, 2010 06:42PM
Hi,

I'm trying to send a POST Subrequest using the same request_body as the
Parent Request.
The subrequest is sent first, and once it has been finalized the parent
request goes through.
(this is inspired on Maxim's ngx_http_auth_request_module)

It works almost fine, but if I try to make this subrequest to a location
containing a proxy_pass, I get some weird behavior. (The connection takes
forever to terminate).

My guess is that the request_body gets read by the upstream, and discarded.
When the parent request goes through, that data is not available anymore.
If I create a dummy request_body for the subrequest with temporary buffers,
it seems to work fine.

I think I might be able to get around this by reading first the original
request_body using ngx_http_read_client_request_body(),
and then copying the content of r->request_body to temporary buffers in my
subrequest.

But I'm not sure that would be the best way to solve this problem.

Any ideas ?

Thank you,

Matthieu.

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

Subrequest using Parent Request Body

Matthieu Tourne May 07, 2010 06:42PM

Re: Subrequest using Parent Request Body

peterjanovsky May 09, 2010 08:30PM

Re: Subrequest using Parent Request Body

agentzh May 09, 2010 11:16PM

Re: Subrequest using Parent Request Body

Maxim Dounin May 10, 2010 09:48PM

Re: Subrequest using Parent Request Body

Matthieu Tourne May 12, 2010 03:20PM

Re: Subrequest using Parent Request Body

Maxim Dounin May 12, 2010 05:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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