Posted on 2010-08-23 10:50:34.8098-07 by llama22
processing HTTP PUT - RESUME (partial content) in cgi
I have a Perl cgi script accepts incoming HTTP POST requests from various clients. The cgi checks the headers for "POST" request and then reads in the data and writes out the data in a file at a specified location on the server.

I had to extend the cgi to also support HTTP PUT RESUME (partial content) functionality. What this means is, the clients sending the data to the cgi will stop/terminate the connection after a specified number of bytes. The client can resume the partial PUT request at a later point of time, the clients will do so until the complete data/attachment is transferred. I'm looking for suggestions on implementing the "partial content" (a.k.a HTTP PUT RESUME ) functionality into the cgi.

How can I implement the following:
* How/where to store the initial partial PUT data
* How to resume the PUT data once the client starts sending the remaining data
* Any Apache mod_perl settings that needed here

Does anyone has sample code or suggestions about how to go about the above.

Below are the headers that I'll be receiving from the client
PUT /pups_00034326714e2364_21.7z HTTP/1.1
Cache-Control: no-store
Connection: close
Expect: 100-continue
Host: test033S2121
User-Agent: curl/7.7.3 (i686-pc-linux-gnu) libcurl 7.7.3 (OpenSSL 0.9.6)
Content-Length: 190626
Content-Range: bytes1024-*/*
Content-Type: application/x-7z-compressed
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.