Exemplo n.º 1
0
    def _assemble_headers(self):
        headers = self.headers.copy()
        utils.del_all(headers, ['Proxy-Connection', 'Transfer-Encoding'])
        if self.content:
            headers["Content-Length"] = [str(len(self.content))]
        elif 'Transfer-Encoding' in self.headers:  # add content-length for chuncked transfer-encoding with no content
            headers["Content-Length"] = ["0"]

        return str(headers)
Exemplo n.º 2
0
    def _assemble_headers(self):
        headers = self.headers.copy()
        utils.del_all(
            headers,
            [
                'Proxy-Connection',
                'Transfer-Encoding'
            ]
        )
        if self.content:
            headers["Content-Length"] = [str(len(self.content))]
        elif 'Transfer-Encoding' in self.headers:  # add content-length for chuncked transfer-encoding with no content
            headers["Content-Length"] = ["0"]

        return str(headers)
Exemplo n.º 3
0
    def _assemble_headers(self):
        headers = self.headers.copy()
        utils.del_all(headers, [
            'Proxy-Connection', 'Keep-Alive', 'Connection', 'Transfer-Encoding'
        ])
        if not 'host' in headers:
            headers["Host"] = [
                utils.hostport(self.scheme, self.host
                               or self.flow.server_conn.address.host, self.port
                               or self.flow.server_conn.address.port)
            ]

        if self.content:
            headers["Content-Length"] = [str(len(self.content))]
        elif 'Transfer-Encoding' in self.headers:  # content-length for e.g. chuncked transfer-encoding with no content
            headers["Content-Length"] = ["0"]

        return str(headers)
Exemplo n.º 4
0
    def _assemble_headers(self):
        headers = self.headers.copy()
        utils.del_all(
            headers,
            [
                'Proxy-Connection',
                'Keep-Alive',
                'Connection',
                'Transfer-Encoding'
            ]
        )
        if not 'host' in headers:
            headers["Host"] = [utils.hostport(self.scheme,
                                              self.host or self.flow.server_conn.address.host,
                                              self.port or self.flow.server_conn.address.port)]

        if self.content:
            headers["Content-Length"] = [str(len(self.content))]
        elif 'Transfer-Encoding' in self.headers:  # content-length for e.g. chuncked transfer-encoding with no content
            headers["Content-Length"] = ["0"]

        return str(headers)