I\'m having troubles connecting with https using urllib2 under Python 2.7.10.
Any thoughts what I\'m missing?
Python 2.7.10 (default, Jun 18 2015, 1
I was able to duplicate your problem on OS X 10.10.3, whose stock Python is 2.7.6 built with OpenSSL 0.9.8zd.
The problem is the lack of the Server Name Indication (SNI) extension in the TLS handshake, which the twitrss.me site apparently requires:
Server Name Indication (SNI) is an extension to the TLS computer networking protocol by which a client indicates which hostname it is attempting to connect to at the start of the handshaking process.
I verified this by writing a small C++ program with OpenSSL, and inserting the OpenSSL call
SSL_set_tlsext_host_name(ssl, "twitrss.me");
allows a successful connection while omitting it fails. I also looked at packet dumps to verify that SNI was missing when attempting connection using Python.
The Python SSL module apparently supports SNI in Python 3 but may require a workaround in Python 2. It appears that PEP 0466 includes SNI and landed in Python 2.7.9, so you should have it, but I don't know if urllib2/urllib3
take advantage of that without the workaround.