0

I have a piece of client software which sends an HTTP POST request asynchronously using a "chunked" transfer encoding ($ENV{HTTP_TRANSFER_ENCODING} is "chunked"), which I'm utterly unfamiliar with -- and unfortunately I can't change the client specification.

I need to write a simple server script to receive the client's chunked data, but I can't figure out how to deal with it. CGI->param isn't giving me anything; nor is <STDIN>. All I can guess is that I need to wait for data chunks to arrive? But I have no idea how to work this in Perl CGI, what to wait on, if there's a built-in routine at all, etc.

FWIW, the client is definitely sending the right data - I peeked at it with a packet sniffer - but I'm not 100% sure that the HTTP request/headers are encoded correctly.

Any sample code for receiving chunked POST data in Perl would be extremely helpful. I'm really hoping there's a way to do it in the CGI module without mucking around at the HTTP layer.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by scrappedcola
0

I maybe wrong but from what I can see Perl CGI (it predates http1.1 which introduced chunked transfer) doesn't handle Chunked data and Apache has to dechunk the data before the CGI can do anything with it. I think you need to config Apache to have mod_perl.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.