openresty / openresty/echo-nginx-module
POST subrequest body doesn't get parent's request body
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.2k
- Forks
- 251
- Avg merge
- 1h 24m
- Merged PRs (30d)
- 2
Description
hi
here is my config and code(ngx_http_echo_subrequest.c->ngx_http_echo_parse_subrequest_spec)
location /fp_guess {
echo_subrequest_async POST /sub1 -h 'body';
#echo_subrequest_async POST /sub2;
#echo_subrequest_async POST /sub3;
#echo_subrequest_async POST /sub4;
}
location /sub1 {
proxy_pass http://192.168.19.223:8980/fp_search.php;
}
...............................................
...............................................
if (ngx_strncmp("-h", arg->data, arg->len) == 0) {
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; // ????? is wrong?
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) {
299 return NGX_ERROR;
300 }
301
302 parsed_sr->content_length_n = body_str->len;
303
304 b = ngx_calloc_buf(r->pool);
................................................................................................
rb = r->request_body
rb->bufs, rb->buf is 0x0 in this line , but r->request_body is in ngx_http_do_read_client_request_body(), did i miss something or the code is wrong?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the POST configuration in the issue, then inspect ngx_http_echo_subrequest.c at ngx_http_echo_parse_subrequest_spec and compare it with ngx_http_do_read_client_request_body(). Trace when r->request_body and rb->bufs are populated, and establish the expected behavior for passing the parent request body to the subrequest.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, nginx
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100