Closed GoogleCodeExporter closed 8 years ago
[deleted comment]
Of course httplib.HTTPSConnection will work as it does no verification...
See http://docs.python.org/library/httplib.html#httplib.HTTPSConnection
I was experiencing this same issue, and it is mainly a problem due to lack of
documentation of changes. httplib2 performs verification of certificates as of
version 0.7.0 and thus often connections that used to work are now failing
because of a failure in verifying certificates. In my case it was because the
cacerts.txt file that is provided with httplib2 and used by default only has a
small subset of the many available CA certificates.
You have two options:
1. Disable SSL certificate verification (NOT RECOMMENDED):
>>> import httplib2
>>> http = httplib2.Http(disable_ssl_certification_validation=True)
>>> http.request('https://en.wikipedia.org')
2. Specify an alternative set of CA certificates:
>>> import httplib2
>>> http = httplib2.Http(ca_certs='/etc/ssl/certs/ca-certificates.crt')
>>> http.request('https://en.wikipedia.org')
Note: The systemwide set of available CA certificates on Ubuntu are available
in the file /etc/ssl/certs/ca-certificates.crt and they can be updated by
following the steps available here:
https://help.ubuntu.com/community/OpenSSL#Importing_a_Certificate_into_the_Syste
m-Wide_Certificate_Authority_Database
I have had plenty of success with this and I don't think it is a bug so much as
a lack of clear documentation about:
1. How httplib2 should be used for SSL connections.
2. Clear warning that the default cacerts.txt file is a very small subset of
certificates.
3. That 0.7.0 was a big breaking change regarding SSL connections.
Hope this helps!
Original comment by nickpope...@gmail.com
on 7 Mar 2012 at 12:04
What a prat I am. I plain didn't read the docs for httplib, and so I didn't
appreciate it didn't do verification - and I got so hung up on the idea of the
wildcard being the problem I didn't look any further.
Specifying the system-wide certs file works like a charm. Under Red Hat (and
similar) the certificates are here: /etc/pki/tls/certs/ca-bundle.crt
Thanks for the help, next time I promise to read the documentation more
thoroughly.
Original comment by dan.cos...@hiveonline.co.uk
on 7 Mar 2012 at 2:16
[deleted comment]
Original comment by joe.gregorio@gmail.com
on 13 Oct 2013 at 3:10
Original issue reported on code.google.com by
dan.cos...@hiveonline.co.uk
on 28 Feb 2012 at 9:27Attachments: