(self)
| 372 | self.headers.append((name, value)) |
| 373 | |
| 374 | def is_chunked(self): |
| 375 | # Only use chunked responses when the client is |
| 376 | # speaking HTTP/1.1 or newer and there was |
| 377 | # no Content-Length header set. |
| 378 | if self.response_length is not None: |
| 379 | return False |
| 380 | elif self.req.version <= (1, 0): |
| 381 | return False |
| 382 | elif self.req.method == 'HEAD': |
| 383 | # Responses to a HEAD request MUST NOT contain a response body. |
| 384 | return False |
| 385 | elif self.status_code in (204, 304): |
| 386 | # Do not use chunked responses when the response is guaranteed to |
| 387 | # not have a response body. |
| 388 | return False |
| 389 | return True |
| 390 | |
| 391 | def default_headers(self): |
| 392 | # set the connection header |
no outgoing calls
no test coverage detected