You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I encountered error when my environment no_proxy includes IPv6 address like ::1. It is wrongly transformed into all://*::1 and causes urlparse error since the _urlparse.py parses the :1 as port.
The get_environment_proxies function in _utils.py is responsible for parsing and mounting proxy info from system environment.
# See https://curl.haxx.se/libcurl/c/CURLOPT_NOPROXY.html for details
# on how names in `NO_PROXY` are handled.
ifhostname=="*":
# If NO_PROXY=* is used or if "*" occurs as any one of the comma
# separated hostnames, then we should just bypass any information
# from HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, and always ignore
# proxies.
return {}
elifhostname:
# NO_PROXY=.google.com is marked as "all://*.google.com,
# which disables "www.google.com" but not "google.com"
# NO_PROXY=google.com is marked as "all://*google.com,
# which disables "www.google.com" and "google.com".
# (But not "wwwgoogle.com")
mounts[f"all://*{hostname}"] =None
returnmounts
For env no_proxy, according to CURLOPT_NOPROXY explained, it should support domains, IPv4, IPv6 and the localhost. However, current get_environment_proxies function implementation only supports domains correctly as it always adds wildcard * in front of the hostname.
To fix this issue, I looked into this repo and suggest handling the no_proxy hostnames as domains, IPv4, IPv6 and the localhost seperately. I have updated the get_environment_proxies function in _utils.py and tested it.
Hi, I encountered error when my environment
no_proxy
includes IPv6 address like::1
. It is wrongly transformed intoall://*::1
and causes urlparse error since the _urlparse.py parses the:1
as port.The
get_environment_proxies
function in _utils.py is responsible for parsing and mounting proxy info from system environment.httpx/httpx/_utils.py
Lines 229 to 264 in 4b5a92e
For env
no_proxy
, according to CURLOPT_NOPROXY explained, it should support domains, IPv4, IPv6 and thelocalhost
. However, currentget_environment_proxies
function implementation only supports domains correctly as it always adds wildcard*
in front of thehostname
.To fix this issue, I looked into this repo and suggest handling the
no_proxy
hostnames as domains, IPv4, IPv6 and thelocalhost
seperately. I have updated theget_environment_proxies
function in _utils.py and tested it.Refer to the PR: #2659
Replies and discussions are welcomed!
The text was updated successfully, but these errors were encountered: