Streaming Files In IE6 with CherryPy - Fix

5 views
Skip to first unread message

lars...@gmail.com

unread,
Oct 31, 2008, 9:31:53 AM10/31/08
to web2py Web Framework
I was following the example here:

http://groups.google.com/group/web2py/browse_thread/thread/f15668449a41362/afdca6efdf668fbb?lnk=gst&q=stream#afdca6efdf668fbb

to stream PDF files. Everytime I would try to open a pdf file,
though, IE6 would error "File Not Found". It worked fine in Firefox.
Turns out it's a bug in IE6 with how CherryPy sets it's default
response headers. Setting the additional headers of Pragma and Cache-
Control fixed it:

response.headers['Content-Type'] = "application/pdf"
response.headers['Content-Disposition']="attachment;
filename=BarCodes.pdf"
response.headers['Pragma']="cache"
response.headers['Cache-Control']="private"
return response.stream(pdfContents,chunk_size=4096)

Just wanted to get that out there so it would be searchable in the
future.

Thanks.

mdipierro

unread,
Oct 31, 2008, 9:41:17 AM10/31/08
to web2py Web Framework
Probably this should be default for streaming. do you agree?

Massimo

On Oct 31, 8:31 am, "larsen...@gmail.com" <larsen...@gmail.com> wrote:
> I was following the example here:
>
> http://groups.google.com/group/web2py/browse_thread/thread/f15668449a...

mdipierro

unread,
Oct 31, 2008, 9:49:24 AM10/31/08
to web2py Web Framework
In trunk. Please give it a try!

Massimo
Reply all
Reply to author
Forward
0 new messages