Welcome! Log In Create A New Profile

Advanced

Re: How to make a post subrequest with response body from parent?.

February 26, 2012 08:15PM
Digging around I was able to get this code so far:

in my module's body filter I do this:

if(ngx_http_subrequest(r, &uri, &query_string, &sr, NULL, 0) != NGX_OK)
return NGX_ERROR;

// adjust subrequest
ngx_str_t method_name = ngx_string("POST");
sr->method = NGX_HTTP_POST;
sr->method_name = method_name;


First of all it still uses GET with fastcgi_pass. If I do proxy_pass instead the method is POST. I think it is a bug in fastcgi module. The above code should be OK so far, since it works with proxy_pass.

Now I don't know how to pass post data to subrequest. I have tried to create a buffer chain with sample data in it and using sr->request_body->bufs, however it doesn't work.

Am I right that if I populate sr->request_body->bufs they will be written to subrequest request body?
Subject Author Posted

How to make a post subrequest with response body from parent?.

edo888 February 25, 2012 07:06PM

Re: How to make a post subrequest with response body from parent?.

edo888 February 26, 2012 08:15PM

Re: How to make a post subrequest with response body from parent?.

edo888 February 26, 2012 08:27PM

Re: How to make a post subrequest with response body from parent?.

edo888 February 27, 2012 02:29PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 194
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready