def set_notchunked_headers(self, l): utils.add_header(self.out_dict['headers'], 'Content-Length', str(l)) if self.environ.get('HTTP_CONNECTION', '').upper() == 'KEEP-ALIVE': utils.add_header(self.out_dict['headers'], 'Connection', 'Keep-Alive')
def set_chunked_headers(self): if self.environ['SERVER_PROTOCOL'] == 'HTTP/1.0': utils.add_header(self.out_dict['headers'], 'Connection', 'close') utils.add_header(self.out_dict['headers'], 'Transfer-Encoding', '') elif self.environ['SERVER_PROTOCOL'] == 'HTTP/1.1': utils.add_header(self.out_dict['headers'], 'Transfer-Encoding', 'chunked')