Version
Installed through pip, from pypi:
pulpcore: 3.20.0
pulp_python: 3.7.1
Describe the bug
Pulp is behind an HTTP proxy. Trying to set up a pull-through cache.
Function pull_through_package_simple ignores my remote's proxy setting and tries to establish a direct connection to pypi.
To Reproduce
pulp python remote create --name pypi --url https://pypi.org/ --proxy-url http://10.20.30.40:8080
pulp distribution create --base-path pypi --remote pypi --name pypi
Go to http://yourpulpserver/pypi/pypi/simple/pulp-python/
Expected behavior
Pulp should connect through the http proxy and display the available packages.
Additional context
Quick+dirty fix. Not sending a pull request because I'm not familiar with pulp source code and how things are done around here.
diff --git a/pulp_python/app/pypi/views.py b/pulp_python/app/pypi/views.py
index 4bb9906..5371c83 100644
--- a/pulp_python/app/pypi/views.py
+++ b/pulp_python/app/pypi/views.py
@@ -193,15 +193,19 @@ class SimpleView(ViewSet, PackageUploadMixin):
def pull_through_package_simple(self, package, path, remote):
"""Gets the package's simple page from remote."""
def parse_url(link):
parsed = urlparse(link.url)
digest, _, value = parsed.fragment.partition('=')
stripped_url = urlunsplit(chain(parsed[:3], ("", "")))
redirect = f'{path}/{link.text}?redirect={stripped_url}'
d_url = urljoin(BASE_CONTENT_URL, redirect)
return link.text, d_url, value if digest == 'sha256' else ''
url = remote.get_remote_artifact_url(f'simple/{package}/')
- response = requests.get(url, stream=True)
+ kwargs = {}
+ if remote.proxy_url:
+ kwargs["proxies"] = {"http": remote.proxy_url, "https": remote.proxy_url}
+
+ response = requests.get(url, stream=True, **kwargs)
links = parse_links_stream_response(response)
packages = (parse_url(link) for link in links)
return StreamingHttpResponse(write_simple_detail(package, packages, streamed=True))
Version
Installed through pip, from pypi:
pulpcore: 3.20.0
pulp_python: 3.7.1
Describe the bug
Pulp is behind an HTTP proxy. Trying to set up a pull-through cache.
Function
pull_through_package_simpleignores my remote's proxy setting and tries to establish a direct connection to pypi.To Reproduce
Go to http://yourpulpserver/pypi/pypi/simple/pulp-python/
Expected behavior
Pulp should connect through the http proxy and display the available packages.
Additional context
Quick+dirty fix. Not sending a pull request because I'm not familiar with pulp source code and how things are done around here.