Commit d900458e authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Romain Courteaud

HTTP: Distrust environment

By default, requests accesses user's .netrc . Disable this using the only
available (though undocumented) way: by having requests distrust the
environment. An unfortunate side-effect is that it will now also ignore
proxy settings (which do come from the environment variables, which would
be fine to access for me, unlike the .netrc).
parent 2fac4172
......@@ -206,15 +206,16 @@ def checkHttpStatus(
parsed_url = urlparse(url)
hostname = parsed_url.hostname
request_kw = {"timeout": timeout}
session = requests.Session()
session.trust_env = False
request_kw["session"] = session
# SNI Support
if parsed_url.scheme == "https":
# Provide SNI support
base_url = urlunsplit(
(parsed_url.scheme, parsed_url.netloc, "", "", "")
)
session = requests.Session()
session.mount(base_url, ForcedIPHTTPSAdapter(dest_ip=ip))
request_kw["session"] = session
ip_url = url
elif parsed_url.scheme == "http":
# Force IP location
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment