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