Compute Content-Length or switch to chunked encoding if possible
(self)
| 203 | |
| 204 | |
| 205 | def set_content_length(self): |
| 206 | """Compute Content-Length or switch to chunked encoding if possible""" |
| 207 | try: |
| 208 | blocks = len(self.result) |
| 209 | except (TypeError,AttributeError,NotImplementedError): |
| 210 | pass |
| 211 | else: |
| 212 | if blocks==1: |
| 213 | self.headers['Content-Length'] = str(self.bytes_sent) |
| 214 | return |
| 215 | # XXX Try for chunked encoding if origin server and client is 1.1 |
| 216 | |
| 217 | |
| 218 | def cleanup_headers(self): |