954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Handling "chunked" form data in Perl CGI?

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 . 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.

tkms
Newbie Poster
1 post since Jul 2010
Reputation Points: 10
Solved Threads: 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.

scrappedcola
Posting Whiz in Training
227 posts since Dec 2009
Reputation Points: 27
Solved Threads: 45
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: