equal
deleted
inserted
replaced
90 else: |
90 else: |
91 env['CONTENT_TYPE'] = self.headers.typeheader |
91 env['CONTENT_TYPE'] = self.headers.typeheader |
92 length = self.headers.getheader('content-length') |
92 length = self.headers.getheader('content-length') |
93 if length: |
93 if length: |
94 env['CONTENT_LENGTH'] = length |
94 env['CONTENT_LENGTH'] = length |
95 for header in [h for h in self.headers.keys() \ |
95 for header in [h for h in self.headers.keys() |
96 if h not in ('content-type', 'content-length')]: |
96 if h not in ('content-type', 'content-length')]: |
97 hkey = 'HTTP_' + header.replace('-', '_').upper() |
97 hkey = 'HTTP_' + header.replace('-', '_').upper() |
98 hval = self.headers.getheader(header) |
98 hval = self.headers.getheader(header) |
99 hval = hval.replace('\n', '').strip() |
99 hval = hval.replace('\n', '').strip() |
100 if hval: |
100 if hval: |
146 def _start_response(self, http_status, headers, exc_info=None): |
146 def _start_response(self, http_status, headers, exc_info=None): |
147 code, msg = http_status.split(None, 1) |
147 code, msg = http_status.split(None, 1) |
148 code = int(code) |
148 code = int(code) |
149 self.saved_status = http_status |
149 self.saved_status = http_status |
150 bad_headers = ('connection', 'transfer-encoding') |
150 bad_headers = ('connection', 'transfer-encoding') |
151 self.saved_headers = [ h for h in headers \ |
151 self.saved_headers = [h for h in headers |
152 if h[0].lower() not in bad_headers ] |
152 if h[0].lower() not in bad_headers] |
153 return self._write |
153 return self._write |
154 |
154 |
155 def _write(self, data): |
155 def _write(self, data): |
156 if not self.saved_status: |
156 if not self.saved_status: |
157 raise AssertionError("data written before start_response() called") |
157 raise AssertionError("data written before start_response() called") |