views:

87

answers:

1

I'm using PyCURL to test a redirection service we're offering- a user hits http://xyz.com/asdf/ and gets redirected to https://a.com, https://b.com and https://c.com.

I'm trying to use PyCURL to request http://xyz.com, and print out (but not HTTP request) the string "https://{a|b|c}.com", but whenever the destination URL is HTTPS and not HTTP, PyCURL.request() method throws the following exception:

(35, 'gnutls_handshake() failed: A TLS fatal alert has been received.')

Googling for "pycurl tls error" doesn't turn up many results, except one that hints that PyCURL for Ubuntu uses GnuTLS instead of OpenSSL. Is this what's causing my problem? If so, how do I configure PyCURL to use OpenSSL?

My OS is Ubuntu 9.10, Python 2.6, and here's my PyCURL version info

>>> pycurl.version_info()

(3, '7.19.5', 463621, 'x86_64-pc-linux-gnu', 1597, 'GnuTLS/2.8.3', 0, '1.2.3.3', ('tftp', 'ftp', 'telnet', 'dict', 'ldap', 'ldaps', 'http', 'file', 'https', 'ftps'), None, 0, '1.15')

Thanks in advance!

A: 

pycurl uses libcurl and libcurl can be built to use one of several TLS libraries. GnuTLS and OpenSSL being two of them. You can thus rebuild libcurl to use whichever of those that you prefer.

Daniel Stenberg