[issue43332] http/client.py: - uses multiple network writes, possibly causing excessive network usage and increased implementation complexity on the other end

Zveinn report at bugs.python.org
Fri Feb 26 15:38:30 EST 2021


Zveinn <sveinn at zkynet.io> added the comment:

def _tunnel(self):
        connect_str = "CONNECT %s:%d HTTP/1.0\r\n" % (self._tunnel_host,
            self._tunnel_port)
        connect_bytes = connect_str.encode("ascii") <<!!-- ASCII
        self.send(connect_bytes)
        for header, value in self._tunnel_headers.items():
            header_str = "%s: %s\r\n" % (header, value)
            header_bytes = header_str.encode("latin-1") <<!!-- LATIN-1
            self.send(header_bytes)
        self.send(b'\r\n')


Is it possible that the method was designed this way so that the header could be encoded with latin-1 while the connect part is encoded in ascii ? Is that needed ?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43332>
_______________________________________


More information about the Python-bugs-list mailing list