[Catalyst] HTTP::Body(::MultiPart) RFC md5 digests for uploads
Andrew Bramble
andrew.bramble at omnilab.com.au
Wed Jun 28 10:05:27 CEST 2006
Hello ,
Having used Catalyst for the last few months I was presented with a challenge;
make Catalyst generate an MD5 sum for each uploaded file in a request, for
files of (almost) arbitary length. Since MD5 summing a 640mb .iso is rather
time consuming, it makes sense to calculate the sum on the fly as the
incoming request is being processed.
It took me some time to track down the fact that HTTP::Body::MultiPart was
responsible for the writing of request data chunks to temporary files.
Attached is a first try at this which includes
patch HTTP::Body::Multipart to create a Digest::MD5 object and ->add chunks
of incoming data to it.
patch Catalyst::Request::Upload to add and accessor for 'md5'
patch &Catalyst::Engine::prepare_uploads to take the upload object(s) from
request->{_body}->upload and create Catalyst::Request::Upload object
including the 'md5' attribute.
I welcome comments about the sense and usefullness of this :)
AB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTTP-Body-MultiPart.pm.digestmd5.patch
Type: text/x-diff
Size: 951 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060628/20e2f9b6/attachment.bin
More information about the Catalyst
mailing list