Help, make a post subrequest with response body from parent

honwel nginx-forum at nginx.us
Wed Apr 9 06:45:35 UTC 2014


hi, angentzh

    I use echo module(angentzh) to issue a subrequest(POST method) that it's
body from parent's request body,  and i add some code in
ngx_http_echo_subrequest->ngx_http_echo_parse_subrequest_spec :
   so, it's not work, but change to '-b' or '-f', it's OK. help ?


........................
             if (ngx_strncmp("-h", arg->data, arg->len) == 0) {   // add
'-h' param
275                 to_write = &h_str;
276                 expecting_opt = 0;
277                 continue;
278             }
279         }
280 
281         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
282                       "unknown option for echo_subrequest_async: %V",
arg);
283 
284         return NGX_ERROR;
285     }
286 
287     if (h_str != NULL && h_str->len) {
288         parsed_sr->query_string = &r->args;
289         if (r->request_body == NULL) {
290             return NGX_ERROR;
291         }
292 
293         rb = r->request_body;                               // make post
body from parent's body,  is right?
               // i track this line by gdb, the r->request_body->buf is
null, and r->request_body->bufs aslo is null. 
294 
295     } else if (body_str != NULL && body_str->len) {
296         rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t));
297 
298         if (rb == NULL) {

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,249140,249140#msg-249140



More information about the nginx mailing list