Skip to content

Commit

Permalink
session: Cache http requests to trusted hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Gorny committed Jan 23, 2021
1 parent b944419 commit ae3b75c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pip/_internal/network/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,20 @@ def add_trusted_host(self, host, source=None, suppress_logging=False):
if host_port not in self.pip_trusted_origins:
self.pip_trusted_origins.append(host_port)

self.mount(
build_url_from_netloc(host, scheme='http') + '/',
self._trusted_host_adapter
)
self.mount(
build_url_from_netloc(host) + '/',
self._trusted_host_adapter
)
if not host_port[1]:
# Mount wildcard ports for the same host.
self.mount(
build_url_from_netloc(host, scheme='http') + ':',
self._trusted_host_adapter
)
self.mount(
build_url_from_netloc(host) + ':',
self._trusted_host_adapter
Expand Down

0 comments on commit ae3b75c

Please sign in to comment.