Sorry, chunk_size does not matter in this case. What I mean is, using a file object as the first parameter of response.stream(...) does NOT support "HTTP/1.1 206 PARTIAL CONTENT". Instead, we should use a file name string. Therefore I suggest to adjust the example document to explicitly compare the two approaches. I refine the doc, please refer to the end of this mail.
On Apr5, 10:08pm, mdipierro <[email protected]> wrote: > You can do > > response.stream(...,chunk_size=4000) > > On Apr 5, 5:57 am, Iceberg <[email protected]> wrote: > > > Hi Massimo, > > > I always follow the sample here to write my streaming code: > > http://www.web2py.com/examples/default/examples#streaming_examples > > > Today I happened to find that this approach does not handle "HTTP/1.1 > > 206 PARTIAL CONTENT" correctly. After some try and search, I found > > this: > > http://groups.google.com/group/web2py/msg/8fa154c4cf1a3a38 > > > Therefore I suggest to adjust the stream sample. How about something > > like these? > > > ============ START ============= > > Example 48 > > > It is very easy in web2py to stream large files. Here is an example of > > a controller that does so: > > > def streamer(): > > return response.stream(open('largefile.mpg4','rb')) > > By default all static files and files stored in 'upload' fields in the > > database are streamed when larger than 1MByte. > > > Even better, if you use: > > def streamer(): > > return > > response.stream('a_file_name_rather_than_a_file_object.mpg4',request=request) > > > web2py automatically and transparently handles PARTIAL_CONTENT and > > RANGE requests. > > > ========== THE END =============== --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

