[Solved] Issue with passing DATA to fcgi process
Added by BTschunko 10 days ago
Hello,
I observed an issue when sending a PUT requests with DATA using curl version equal or higher than 8.2.0. Since this version the DATA is sent together with the HEADER in the same frame (see curl change https://github.com/curl/curl/commit/c9ec85121110).
As far as I can see, in this case the DATA is not passed to the required fastcgi process by the lighttpd.
Here a wireshark trace of an older version of curl where HEADER and DATA are sent separately:
Here everything works.
When sending HEADER and DATA in the same frame the wireshark trace is the following:
I also traced the lighttpd calls on linux. Attached the trace with the Error Case first (DATA sent together with the HEADER) and the the Goos Case second (HEADER and DATA sent in different frames).
We have a fastcgi process in authorizer mode (using socket /tmp/auths_resource_server.socket*) followed by an fastcgi process in normal mode (using socket /tmp/restapi.socket*).
Here you can see that the DATA is not passed to the normal fastcgi process when HEADER and DATA are sent in the same frame.
Thank for any support on this issue.
Regards
Benjamin
clipboard-202412121202-hkspg.png (76.8 KB) clipboard-202412121202-hkspg.png | wireshark - HEADER and DATA sent in different frames | ||
clipboard-202412121203-k0jhf.png (28.4 KB) clipboard-202412121203-k0jhf.png | wireshark - HEADER and DATA sent in same frame | ||
lighttpd_trace.log (15.4 KB) lighttpd_trace.log | Linux call trace |
Replies (4)
RE: Issue with passing DATA to fcgi process - Added by gstrauss 8 days ago
Please try this patch (edited):
--- a/src/mod_fastcgi.c +++ b/src/mod_fastcgi.c @@ -187,6 +187,7 @@ static handler_t fcgi_stdin_append(handler_ctx *hctx) { off_t req_cqlen = chunkqueue_length(req_cq); int request_id = hctx->request_id; if (req_cqlen > MAX_WRITE_LIMIT) req_cqlen = MAX_WRITE_LIMIT; + if (hctx->gw_mode == GW_AUTHORIZER) req_cqlen = 0; /* something to send ? */ for (offset = 0; offset != req_cqlen; offset += weWant) { @@ -281,7 +282,7 @@ static handler_t fcgi_create_env(handler_ctx *hctx) { chunkqueue_prepend_buffer_commit(&hctx->wb); } - if (r->reqbody_length) { + if (r->reqbody_length && hctx->gw_mode != GW_AUTHORIZER) { /*chunkqueue_append_chunkqueue(&hctx->wb, &r->reqbody_queue);*/ if (r->reqbody_length > 0) hctx->wb_reqlen += r->reqbody_length;/* (eventual) (minimal) total request size, not necessarily including all fcgi_headers around content length yet */ --- a/src/gw_backend.c +++ b/src/gw_backend.c @@ -1932,6 +1932,8 @@ static void gw_conditional_tcp_fin(gw_handler_ctx * const hctx, request_st * con static handler_t gw_write_refill_wb(gw_handler_ctx * const hctx, request_st * const r) { if (chunkqueue_is_empty(&r->reqbody_queue)) return HANDLER_GO_ON; + if (hctx->gw_mode == GW_AUTHORIZER) + return HANDLER_GO_ON; if (hctx->stdin_append) { if (chunkqueue_length(&hctx->wb) < 65536 - 16384) return hctx->stdin_append(hctx);
RE: Issue with passing DATA to fcgi process - Added by BTschunko 6 days ago
Thanks for the quick response. I tried the patch above and is seems to fix my issue.
Is it possible to get an official patch or version with the fix?
Thanks a lot.
RE: Issue with passing DATA to fcgi process - Added by gstrauss 6 days ago
Thank you for testing. A lighttpd release is already scheduled for beginning of Jan. The patch will be on lighttpd git master branch sooner.
RE: [Solved] Issue with passing DATA to fcgi process - Added by BTschunko 6 days ago
That sounds good.