Ok, thanks for that. However, when I call response.stream(myfilename, request=request), it seems to stream it in 64K chunks, and tracing the code confirms it as far as I can see.
I'm confused because despite passing in chunk_size as a parameter, it had no effect on the streaming. Also I'm not understanding the documentation then: >> response.stream(file, chunk_size): when a controller returns it, web2py >> streams the file content back to the client in blocks of size chunk_size. Does that mean that if file is a filename, then chunk_size is ignored? Why wouldn't it be passed in to the stream_file_or_304_or_206 call? Finally, the documentation doesn't seem entirely clear that if "request" is not passed in as a parameter, it won't stream correctly (or at least that's my experience... it always restarted from the beginning ignoring the http header range). Thanks, Clayton On Nov 18, 4:41 pm, mdipierro <[email protected]> wrote: > Not a bug. > > chunk_size applies when you are returning a file-like object that > needs to be streamed. If you return a string, it is not streamed. > > Massimo > > On Nov 18, 3:04 pm, Clayton <[email protected]> wrote: > > > > > > > > > The chunk_size seems to be ignored in response.stream > > > def stream( > > self, > > stream, > > chunk_size = DEFAULT_CHUNK_SIZE, > > request=None, > > ): > > """ > > if a controller function:: > > > return response.stream(file, 100) > > > the file content will be streamed at 100 bytes at the time > > """ > > > if isinstance(stream, (str, unicode)): > > stream_file_or_304_or_206(stream, request=request, > > headers=self.headers) <<<< NOT > > PASSED IN TO stream_file_or_304_206!! > > > Thanks, > > > Clayton

