[Tilecache] TileCache and Keep-Alive

Guillaume Sueur guillaume.sueur at neogeo-online.net
Thu May 22 08:09:10 EDT 2008


nice !
here it is then


Christopher Schmidt a écrit :
> On Thu, May 22, 2008 at 09:25:52AM +0200, Guillaume Sueur wrote:
>> Done here.
>> What is the commit procedure ?
> 
> 'svn diff', attach a patch to a post to the mailing list.
> 
>> Guillaume
>>
>> Christopher Schmidt a écrit :
>>> On Wed, May 21, 2008 at 11:53:14PM +0200, Guillaume Sueur wrote:
>>>> Actually, I did make ab handle KeepAlive HTTP connection by using a raw 
>>>> ApacheReq.headers_out['Content-Length'] = len(image)
>>>> in modPythonHandler.
>>>> I'm not sure it has any impact on a classic use of TileCache, i.e. via a 
>>>> web browser.
>>>> So, is it worth to submit this patch against the trunk ? For me it looks 
>>>> more like a hack for ab, and it seems to be confusing regarding the 
>>>> 'chunk' transfert-encoding which is designed NOT TO specify the 
>>>> content-length.
>>>> I'm not an HTTP guru, but as I can read in its specs 
>>>> (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html):
>>>> If a message is received with both a Transfer-Encoding header field and 
>>>> a Content-Length header field, the latter MUST be ignored.
>>> We don't use transfer-encoding. content-length can't hurt anything. I'd
>>> be happy to see it added to all the handlers. 
>>>
>>> Regards,
> 

-- 
Guillaume SUEUR
Expert SIG et OpenSource
NEOGEO
46 RUE MATABIAU
31000 TOULOUSE
06 74 91 95 20
Site web : http://www.neogeo-online.net

-------------- next part --------------
Index: trunk/tilecache/TileCache/Service.py
===================================================================
--- trunk/tilecache/TileCache/Service.py	(révision 297)
+++ trunk/tilecache/TileCache/Service.py	(copie de travail)
@@ -220,6 +220,7 @@
                                 apacheReq.method,
                                 host )
         apacheReq.content_type = format
+        apacheReq.headers_out['Content-Length']=str(len(image))
         apacheReq.send_http_header()
         apacheReq.write(image)
     except Layer.TileCacheException, E:
@@ -255,7 +256,8 @@
         fields = parse_formvars(environ)
 
         format, image = service.dispatchRequest( fields, path_info, req_method, host )
-        start_response("200 OK", [('Content-Type',format)])
+        start_response("200 OK", [('Content-Type',format),
+                                  ('Content-Length', str(len(image)))])
         return [image]
 
     except TileCacheException, E:
@@ -286,6 +288,7 @@
         req_method = os.environ["REQUEST_METHOD"]
         format, image = service.dispatchRequest( params, path_info, req_method, host )
         print "Content-type: %s\n" % format
+        print "Content-Length: %s\n" % str(len(image))
 
         if sys.platform == "win32":
             binaryPrint(image)


More information about the Tilecache mailing list