Skip to content

Pip no longer works with http version of --index-url #1036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ericfrederich opened this issue Jul 9, 2013 · 10 comments
Closed

Pip no longer works with http version of --index-url #1036

ericfrederich opened this issue Jul 9, 2013 · 10 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@ericfrederich
Copy link

This is how I was previously able to install packages.

http_proxy="some.internal.proxy.net:80" pip install --index-url=http://pypi.python.org/simple/ some_package

This stopped working recently.
My network has issues with https traffic and the above command was my way around it.

It looks like the server is returning 301 and redirecting to the https version of the page. This will not work for me. Any suggestions?

$ curl -i -xsome.internal.proxy.net:80 http://pypi.python.org/simple/
HTTP/1.1 301 Moved Permanently
Retry-After: 0
Location: https://pypi.python.org/simple/
Content-Length: 0
Accept-Ranges: bytes
Date: Tue, 09 Jul 2013 18:37:20 GMT
Proxy-Connection: Close

@dstufft
Copy link
Member

dstufft commented Jul 9, 2013

Does "My network have issues with https traffic" mean your network has something like a bluecoat or brocade device which intercepts TLS traffic and replaces the SSL cert with own of it's own creation?

@PaulMcMillan
Copy link

Can you explain more about why https is impossible on your network?

If you've got an SSL intercept device that prevents HTTPS, you can pass an alternate trusted certificate to pip so that it trusts that device.

If SSL is blocked at the firewall for some reason, can you use your exit proxy as a socks proxy with a socks tunneling wrapper?

@ericfrederich
Copy link
Author

@dstufft @PaulMcMillan ... thanks for your replies.

I don't think my environment really has issues with https, perhaps I shouldn't have said it like that.
I myself seem to have issues with the proxy and configuring every single piece of software to use it.

What is weird is that I am totally able to get the https version of the page with curl.

$ curl -s -i -xsome.internal.proxy.net:80 https://pypi.python.org/simple/ | head -n20
HTTP/1.0 200 Connection established

HTTP/1.1 200 OK
Date: Wed, 10 Jul 2013 00:47:13 GMT
Content-Type: text/html; charset=utf-8
X-PYPI-LAST-SERIAL: 812195
Cache-Control: max-age=86400, public
Strict-Transport-Security: max-age=31536000
Content-Length: 1499786
Accept-Ranges: bytes
Age: 5183
Vary: Accept-Encoding

<html><head><title>Simple Index</title><meta name="api-version" value="2" /></head><body>
<a href='0x10c-asm/'>0x10c-asm</a><br/>
<a href='1009558_nester/'>1009558_nester</a><br/>
<a href='18-e/'>18-e</a><br/>
<a href='1ee/'>1ee</a><br/>
<a href='1pass/'>1pass</a><br/>
<a href='2C.py/'>2C.py</a><br/>

... yet this is what happens when I use pip...

$ http_proxy="some.internal.proxy.net:80" pip install --index-url=https://pypi.python.org/simple/ bottle
Downloading/unpacking bottle
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement bottle
No distributions at all found for bottle

perhaps this is related to issue #1017

@dstufft
Copy link
Member

dstufft commented Jul 10, 2013

It looks like your proxy does not have an SSL certificate at all? Does it respond to port 443 with a SSL certificate? You might need to use https_proxy as the envvar.

@ericfrederich
Copy link
Author

@dstufft I didn't realize https_proxy was a separate thing.

I set https_proxy to the same thing but with 443 instead of 80 and it now works for me. THANKS!!!

I don't know why curl was able to get it fine with only http_proxy but pip needs https_proxy.
In fact, I think the way I have my web browsers set up I just specify a single port 80 proxy and it works too.

Perhaps both curl and Firefox do some logic where if http_proxy is set it uses the same proxy for https?

Should pip do the same?

@dstufft
Copy link
Member

dstufft commented Jul 12, 2013

Going to close this since the issue is solved. I don't think pip should do the same logic but if you feel strongly about it I encourage you to open a ticket for that issue itself.

@dstufft dstufft closed this as completed Jul 12, 2013
@ericfrederich
Copy link
Author

I agree with closing this and thanks for your help @dstufft .

I'm not sure how I feel about pip and curl/firefox having the same logic with regard to http_proxy vs. https_proxy.
Of all the software I've used on Linux I think pip is the first instance I have seen where I needed to specify https_proxy separately.
I think it might be an issue of what is correct and what is common practice.
Maybe there isn't a "correct" behavior defined; I don't know.
Perhaps its not even a Pip thing, maybe its a urllib2 problem?

Does freedesktop.org have any opinions about how software should behave?

@hvram1
Copy link

hvram1 commented Sep 30, 2013

i have the same issue . It is not working even if i set https_proxy . If I do a tcpdump I see the 301 redirect and after that I see that there is no fetch for the https url

@dstufft
Copy link
Member

dstufft commented Sep 30, 2013

What version of pip?

@hvram1
Copy link

hvram1 commented Sep 30, 2013

pip 1.0 from /usr/lib/python2.7/dist-packages (python 2.7)

On Mon, Sep 30, 2013 at 4:49 PM, Donald Stufft notifications@gh.loli.gardenwrote:

What version of pip?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1036#issuecomment-25352793
.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

4 participants