[Twisted-web] Off topic: streaming animated GIFs

Tommi Virtanen tv at twistedmatrix.com
Wed Dec 21 02:07:44 MST 2005

Mike Pelletier wrote:
> This is a really great idea!  Are there any gotchas that should be mentioned?  
> Does the GIF header not specify the number of frames?  And even if the GIF 

Dug up old code with more concrete things. Now that I look at it in more
detail, there were problems with multiframe GIFs, so I ended up doing

HTTP/1.1 200 OK
Connection: close
Content-type: multipart/x-mixed-replace; boundary=--myboundary
Pragma: no-cache
Cache-Control: no-cache

Content-Type: image/jpeg

<put a jpeg here>
<delay for e.g. 5 seconds here>Content-Type: image/jpeg

<put a jpeg here>
etc etc..

just make sure you close that stream at some point, at least at that
time Netscape on windows did not obey refreshes dictated by HTTP headers
if the page contained an <img> that was still being pushed.

More information about the Twisted-web mailing list