Skip to content
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

Use HTTPS in artresizer.py #2244

Closed
wants to merge 1 commit into from
Closed

Use HTTPS in artresizer.py #2244

wants to merge 1 commit into from

Conversation

orf
Copy link

@orf orf commented Oct 30, 2016

https://images.weserv.nl/ works fine, lets use that as the default?

@Freso
Copy link
Member

Freso commented Oct 30, 2016

If the server is using SNI it won't work on Python <2.7.9. There doesn't seem to be a good (= simple and 100% accurate) way to find out whether it is, except for actually trying to connect to using a client that doesn't understand SNI (e.g., Python <2.7.9).

@jackwilsdon
Copy link
Member

It looks like @Freso is correct:

$ pyenv local 2.7
$ python --version
Python 2.7
import requests
requests.get('https://images.weserv.nl/?url=avatars0.githubusercontent.com/u/15920313&shape=circle&w=200')
/Users/jack/.pyenv/versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/Users/jack/.pyenv/versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jack/.pyenv/versions/2.7/lib/python2.7/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/Users/jack/.pyenv/versions/2.7/lib/python2.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/jack/.pyenv/versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/jack/.pyenv/versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/Users/jack/.pyenv/versions/2.7/lib/python2.7/site-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:507: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error

The request works fine if I change https back to http. I'm led to believe we're heading towards dropping 2.7 support eventually, so I'm not sure if this should be merged yet or not.

@sampsyo
Copy link
Member

sampsyo commented Nov 2, 2016

Thank you for confirming, @jackwilsdon! As discussed briefly over in #2248, we might need a version check for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants