Mercurial > hg-stable
diff mercurial/hgweb/request.py @ 2514:419c42223bee
Really fix http headers for web UI and issue 254.
This also arranges for static content to allow a keepalive connection.
author | Eric Hopper <hopper@omnifarious.org> |
---|---|
date | Tue, 27 Jun 2006 09:33:12 -0700 |
parents | 7e01da2bc7f3 |
children | b8ccf6386db7 |
line wrap: on
line diff
--- a/mercurial/hgweb/request.py Tue Jun 27 09:30:50 2006 -0700 +++ b/mercurial/hgweb/request.py Tue Jun 27 09:33:12 2006 -0700 @@ -57,20 +57,21 @@ return self.inp.read(count) def write(self, *things): - if self.server_write is None: - if not self.headers: - self.header() - self.server_write = self.start_response('200 Script output follows', - self.headers) - self.start_response = None - self.headers = None for thing in things: if hasattr(thing, "__iter__"): for part in thing: self.write(part) else: + thing = str(thing) + if self.server_write is None: + if not self.headers: + raise RuntimeError("request.write called before headers sent (%s)." % thing) + self.server_write = self.start_response('200 Script output follows', + self.headers) + self.start_response = None + self.headers = None try: - self.server_write(str(thing)) + self.server_write(thing) except socket.error, inst: if inst[0] != errno.ECONNRESET: raise