Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/server.py @ 18353:a9fd11ffa13f
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.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 15 Jan 2013 01:10:08 +0100 |
parents | c007e5c54b16 |
children | cf5c76017e11 |
comparison
equal
deleted
inserted
replaced
18352:e33b9b92a200 | 18353:a9fd11ffa13f |
---|---|
127 SocketServer.ThreadingMixIn) | 127 SocketServer.ThreadingMixIn) |
128 env['wsgi.multiprocess'] = isinstance(self.server, | 128 env['wsgi.multiprocess'] = isinstance(self.server, |
129 SocketServer.ForkingMixIn) | 129 SocketServer.ForkingMixIn) |
130 env['wsgi.run_once'] = 0 | 130 env['wsgi.run_once'] = 0 |
131 | 131 |
132 self.close_connection = True | |
133 self.saved_status = None | 132 self.saved_status = None |
134 self.saved_headers = [] | 133 self.saved_headers = [] |
135 self.sent_headers = False | 134 self.sent_headers = False |
136 self.length = None | 135 self.length = None |
137 for chunk in self.server.application(env, self._start_response): | 136 for chunk in self.server.application(env, self._start_response): |
152 if h[0].lower() == 'content-length': | 151 if h[0].lower() == 'content-length': |
153 should_close = False | 152 should_close = False |
154 self.length = int(h[1]) | 153 self.length = int(h[1]) |
155 # The value of the Connection header is a list of case-insensitive | 154 # The value of the Connection header is a list of case-insensitive |
156 # tokens separated by commas and optional whitespace. | 155 # tokens separated by commas and optional whitespace. |
157 if 'close' in [token.strip().lower() for token in | |
158 self.headers.get('connection', '').split(',')]: | |
159 should_close = True | |
160 if should_close: | 156 if should_close: |
161 self.send_header('Connection', 'close') | 157 self.send_header('Connection', 'close') |
162 self.close_connection = should_close | |
163 self.end_headers() | 158 self.end_headers() |
164 self.sent_headers = True | 159 self.sent_headers = True |
165 | 160 |
166 def _start_response(self, http_status, headers, exc_info=None): | 161 def _start_response(self, http_status, headers, exc_info=None): |
167 code, msg = http_status.split(None, 1) | 162 code, msg = http_status.split(None, 1) |