[Seaside] support for streamed files with Zinc adaptor?
philippe.marschall at gmail.com
Tue Jun 19 18:15:31 UTC 2012
On Tue, Jun 19, 2012 at 4:12 PM, Sven Van Caekenberghe <sven at beta9.be> wrote:
> Hi Esteban,
> On 19 Jun 2012, at 15:31, Esteban Lorenzano wrote:
>> Hi Sven el all
>> I'm using Zinc-Adaptor and I need to upload files. I remember Comanche adaptor had support for streamed files (they were derived to a temporary file instead load everything in the image).
>> While I could configure nginx or apache to do that, I would like to be able to do it using plain Seaside too.
>> It is possible with Zinc-Adaptor?
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
> I am (still) confused as to what exactly is expected of a 'streaming' Seaside adaptor.
There are two different issues, file upload streaming and response streaming.
What I believe is wanted here is file upload streaming. The idea is
that instead of loading the whole contents of a file upload into
memory (and copying it several times along the way) you stream the
contents into a file on disk and just get a "handle" to the file.
Dealing with multipart mime makes this a bit tricky, you don't want to
do this for normal upload fields. So you need to hook into your mime
parser. It's basically the same as mod_upload does . Looking for
references to WATemporaryFile in an up to date Seaside image 
should get you started. Note that the Comanche implementation relies
on the fact that the request is dispatched after the headers are
parsed before the body is fully parsed.
The other thing is response streaming, sending data to the client
before the response is fully computed. An example for this is to send
the html header when you start rendering the body so that the user
agent can start downloading linked resources. If you don't know how
long the response is going to be (because it still being build) you'll
have to resort to chunking. See WAComboResponse >> #flush to get you
More information about the seaside