[PATCH 06 of 12] serve: remove connection close hack for Python 2.3

Mads Kiilerich mads at kiilerich.com
Fri Jan 11 17:32:50 CST 2013


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1357947109 -3600
# Node ID 6f13eaaf47953e4f05a48e32449e53032feb479e
# Parent  0b68f70d936fb309243f0c42ec5131cd1e11ae60
serve: remove connection close hack for Python 2.3

Introduced in 276de216d2c5 and no longer needed - BaseHTTPServer handles
connection closing just fine if we don't mess with its internals.

diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -129,7 +129,6 @@
                                               SocketServer.ForkingMixIn)
         env['wsgi.run_once'] = 0
 
-        self.close_connection = True
         self.saved_status = None
         self.saved_headers = []
         self.sent_headers = False
@@ -152,12 +151,8 @@
                 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
         self.end_headers()
         self.sent_headers = True
 


More information about the Mercurial-devel mailing list