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

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 11, 2013, 11:32 p.m.
Message ID <6f13eaaf47953e4f05a4.1357947170@mk-desktop>
Download mbox | patch
Permalink /patch/567/
State Accepted
Commit a9fd11ffa13fb8e913e6c15c53283c9eb5ea3e29
Headers show

Comments

Mads Kiilerich - Jan. 11, 2013, 11:32 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@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.

Patch

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