diff mercurial/hgweb/server.py @ 2584:1f4703115e28

merge with crew
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 09 Jul 2006 14:42:18 +0200
parents 276de216d2c5
children c4325f0a9b91
line wrap: on
line diff
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -127,6 +127,11 @@ class _hgwebhandler(object, BaseHTTPServ
             if h[0].lower() == 'content-length':
                 should_close = False
                 self.length = int(h[1])
+        # The value of the Connection header is a list of case-insensitive
+        # tokens separated by commas and optional whitespace.
+        if 'close' in [token.strip().lower() for token in 
+                       self.headers.get('connection', '').split(',')]:
+            should_close = True
         if should_close:
             self.send_header('Connection', 'close')
         self.close_connection = should_close