I modified the "snap init" default server to have an upload form, and
a handler that calculates the sha256 of each uploaded file, and
displays the hashes in a table once done.  The code is online at
https://github.com/tsuraan/shaserv .  In making this server, I ran
into some things that raised questions, so I'm hoping somebody who
understands Snap well can help me out.

First off, does my use of handleMultipart look right?  My "part
processor" function (line 80 of Site.hs) seeds the Iteratee with an
empty Chunks list; this seems sort of wrong, but I wasn't sure what to
do to get the types to work out; the reasoning behind Iteratee vs.
Step is unclear to me; I guess I don't see why both are needed, since
just having a Step seems sufficient for what I'm doing.

Next, when actually running this server (ghc 6.12.3, snap 0.4.2) it
leaks memory.  Like, a ton of memory.  It looks like the entirety of
each uploaded file is cached in RAM, and the references are somehow
never lost.  I assume I'm doing something stupid, but I don't see
what.

Finally, I am generating my (horribly broken) HTML response by hand
rather than using heist because I couldn't see how to iterate over a
list in heist.  Did I miss that, or does heist not have a looping
construct?

Thanks for any input; I'd really love to get a handle on this system,
but I'm clearly not there yet.
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to