Mercurial > hg
comparison mercurial/hgweb/server.py @ 6784:18c429ea3a0e
hgweb: all protocol functions have become generators
Using the write() callable supplied by the start_response() call is
frowned upon by the WSGI spec, returning an iterable over the content chunks
is the recommended way. Be aware, though: returning many small chunks will
slow down responses, because the server has to flush each chunk separately.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sun, 29 Jun 2008 15:23:09 +0200 |
parents | f615ece5fec3 |
children | 63b5f4c73c98 |
comparison
equal
deleted
inserted
replaced
6783:6d824dc86907 | 6784:18c429ea3a0e |
---|---|
120 self.close_connection = True | 120 self.close_connection = True |
121 self.saved_status = None | 121 self.saved_status = None |
122 self.saved_headers = [] | 122 self.saved_headers = [] |
123 self.sent_headers = False | 123 self.sent_headers = False |
124 self.length = None | 124 self.length = None |
125 self.server.application(env, self._start_response) | 125 for chunk in self.server.application(env, self._start_response): |
126 self._write(chunk) | |
126 | 127 |
127 def send_headers(self): | 128 def send_headers(self): |
128 if not self.saved_status: | 129 if not self.saved_status: |
129 raise AssertionError("Sending headers before start_response() called") | 130 raise AssertionError("Sending headers before start_response() called") |
130 saved_status = self.saved_status.split(None, 1) | 131 saved_status = self.saved_status.split(None, 1) |