Sample Header Ad - 728x90

Apache mod_cgi to accept chunked requests dynamically (And reply)

0 votes
0 answers
28 views
I am working with a mod_cgi application and a client that sends data in chunked form over a period of time. But the issue is on the server, my cgi script can't reply until the client terminates. I can use wireshark with curl to send chunked requests and validate that I am sending them correctly:
for i in $(seq 5); do date; sleep 1; done | \
 curl --noproxy '*' -H "Transfer-Encoding: chunked" \
     -H "Content-Type: application/json" -X POST -T - \
     https://example.com/test.cgi 
I can see the request start, and chunked messages start streaming. But, on the server, running Apache 2.4.57, I am using mod_cgi with the following flags:
Options +ExecCGI
	AddHandler cgi-script .cgi
The application is invoked but, no reply is possible until after the request is done. How can I get Apache to invoke the CGI script after the connection is established, request made, but data is incomplete? I found a link here with someone saying it is possible, but I see nowhere else online saying how to do it: https://stackoverflow.com/a/284869/2926815 Edit, I also found this link of someone who pointed out how to do the curl client-side with this https://unix.stackexchange.com/a/469060/510722 (Which is how I got my arguments for testing) - and I did validate the curl is actually sending the chunked data at the correct times.
Asked by Charles Lohr (133 rep)
Oct 3, 2024, 12:08 AM
Last activity: Oct 3, 2024, 12:28 AM