[Seaside] support for streamed files with Zinc adaptor?

Sven Van Caekenberghe sven at beta9.be
Tue Jun 19 20:06:03 UTC 2012

Hey Philippe,

On 19 Jun 2012, at 20:15, Philippe Marschall wrote:

> 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?
>>> thanks,
>>> Esteban_______________________________________________
>> 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 [2]. Looking for
> references to WATemporaryFile in an up to date Seaside image [1]
> 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.

Thanks for the excellent, to the point explanation.
I browsed the code and found what I was looking for.

This won't be easy as it depends on, first a streaming multipart parser (the one currently used is based on your AJP parser that works on a byte array, do you have another one ?), second in Zn currently only generic byte streams can be seen as streaming entities, not interpreted/parsed ones like multipart, I'll have to think about that.

And then indeed, there is the interaction between the server and the adaptor. Hmm. a challenge indeed.

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

Very interesting as well.
Is this working ? Using which adaptor ?

> [1] http://jenkins.lukas-renggli.ch/job/Seaside%203.1/lastSuccessfulBuild/artifact/seaside31-kom.zip
> [2] http://apache.webthing.com/mod_upload/
> Cheers
> Philippe


Sven Van Caekenberghe
Smalltalk is the Red Pill

More information about the seaside mailing list