Skip to content

Commit ae3b75c

Browse files
author
Noah Gorny
committed
session: Cache http requests to trusted hosts
1 parent b944419 commit ae3b75c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/pip/_internal/network/session.py

+8
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,20 @@ def add_trusted_host(self, host, source=None, suppress_logging=False):
327327
if host_port not in self.pip_trusted_origins:
328328
self.pip_trusted_origins.append(host_port)
329329

330+
self.mount(
331+
build_url_from_netloc(host, scheme='http') + '/',
332+
self._trusted_host_adapter
333+
)
330334
self.mount(
331335
build_url_from_netloc(host) + '/',
332336
self._trusted_host_adapter
333337
)
334338
if not host_port[1]:
335339
# Mount wildcard ports for the same host.
340+
self.mount(
341+
build_url_from_netloc(host, scheme='http') + ':',
342+
self._trusted_host_adapter
343+
)
336344
self.mount(
337345
build_url_from_netloc(host) + ':',
338346
self._trusted_host_adapter

0 commit comments

Comments
 (0)