[Seaside] Re: Re: [squeak-dev] [Q] File Upload/Download Server, Comanche or Swazoo

Philippe Marschall philippe.marschall at gmail.com
Wed Jul 23 21:17:10 UTC 2008

2008/7/23 Janko Mivšek <janko.mivsek at eranova.si>:
> Philippe Marschall wrote:
>>> Swazoo 2.x has streaming upload and download capability and can easily
>>> handle such big files. I tested with few GB by myself. On both Squeak and
>>> VW.
>>> Maybe it is a time to add that streaming to your Swazoo adaptor too? See
>>> http://www.swazoo.org/streaming.html for more. See also HTTPRequestTest
>>> with
>>> examples, how to use it (testing-posts).
>> That assumes you already know the names of the fields containing files
>> which I don't. I can only see #postDataKeys and #postKeysAndValuesDo:
>> which seem to read the full request. I also couldn't find a test (or
>> sender) for #postDataAt:beforeStreamingDo:.
> Not knowing names of the fields is the whole point of "deferring" parsing
> the POST request until this information is known. Deferring means that
> request is not read and completely parsed already by Swazoo but lately, when
> some post data is first needed. That allows you to delay streaming too,
> until you have enough info where to stream and to open the destination file
> accordingly.
> See this example from http://www.swazoo.org/streaming.html:
> Site>>answerTo: aHTTPRequest
>  | stream |
>  aHTTPRequest
>    postDataAt: 'file'
>    beforeStreamingDo: [:datum |
>      stream := (SpFilename named: datum filename) writeStream.
>      datum writeStream: stream].
>  aHTTPRequest ensureFullRead. "to be sure streaming occurs"
>  stream close.           "mandatory, to close open stream! "
>  ^HTTPResponse ok
> In that example we open a file named as the original file, which  is sent in
> request as post data, just before a file content.
> I hope that helps

Nope sorry. See the attached code. Your example and the attachment
work only if there is an upload filed with the name 'file'. That's the
only upload filed that will be streamed. That's why the attached code
breaks. If you change the name of the upload field to 'file' then the
code breaks somewhere in MultiByteFileStream (Squeak 3.9 Mac VM).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: STStreamSite.st
Type: application/octet-stream
Size: 2108 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/seaside/attachments/20080723/f01564f5/STStreamSite.obj

More information about the seaside mailing list