[issue34516] httplib sets unbefitting "Host" in request header when requests an ipv6 format url.

chen wu report at bugs.python.org
Tue Aug 28 04:39:17 EDT 2018


chen wu <wuchen12 at huawei.com> added the comment:

yeah, i noticed that. but this function also return host with '[]'.

183    # IPv6
184    if url and url[0] == '[':
185        host, url = url.split(']', 1)
186        host += ']'

if url is [aaa:bbb]:123, host is [aaa:bbb] and url is ':123'after this process.

when host=[aaa:bbb] passed to httplib.HTTPConnection, its function 'putrequest' will put 'Host:[[aaa:bbb]]:123' in headers.

----------

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


More information about the Python-bugs-list mailing list