[Tilecache] Tiny patch to add a content length header

Mak Kolybabi mak.kolybabi at telenium.ca
Mon Jan 25 13:22:26 EST 2010


Attached is a *trivial* one-liner patch that adds a content length header to the
mod_python handler. It would probably make sense to add it to all of the other
handlers (CGI, etc.) as well, but I don't have a test environment for them.

The reason I needed this header to exist was that Firebug and TamperData
couldn't figure out the size of things on their own. This change is tested on
2.10, but the diff was made against the SVN trunk.

-- 
Mak Kolybabi
Programmer
Telenium Inc.
204-957-2821
-------------- next part --------------
Index: TileCache/Service.py
===================================================================
--- TileCache/Service.py	(revision 397)
+++ TileCache/Service.py	(working copy)
@@ -262,6 +262,7 @@
             if service.cache.expire:
                 apacheReq.headers_out['Expires'] = email.Utils.formatdate(time.time() + service.cache.expire, False, True)
                 
+        apacheReq.set_content_length(len(image))
         apacheReq.send_http_header()
         if format.startswith("image/") and service.cache.sendfile:
             apacheReq.write("")


More information about the Tilecache mailing list