PyCURL:TLS握手错误 [英] PyCURL: TLS Handshake Error

查看:686
本文介绍了PyCURL:TLS握手错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PyCURL测试我们提供的重定向服务 - 用户点击 http:// xyz。 com / asdf / ,并重定向到 https://a.com https://b.com https://c.com

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.

我试图使用PyCURL请求 http:// xyz.com ,并打印出(但不是HTTP请求)字符串https:// {a | b | c} .com,但每当目标URL是HTTPS而不是HTTP时,PyCURL.request )方法抛出以下异常:

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()失败:收到了TLS致命警报。 c $ c>

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

Googlingpycurl tls error不会产生很多结果,除了一个提示PyCURL为Ubuntu使用GnuTLS而不是OpenSSL。这是什么导致我的问题?如果是这样,我如何配置PyCURL使用OpenSSL?

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?

我的操作系统是Ubuntu 9.10,Python 2.6,这里是我的PyCURL版本信息

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')

p>

推荐答案

我刚刚解决了同样的问题。我不是100%肯定是什么错了。
但是我通过 apt-get install python-pycurl 安装了pycurl,我认为默认情况下使用gnutls,但它似乎在我的系统上应该是openssl。

I just resolved the same issue. I'm not 100% sure what was wrong. But I installed pycurl via apt-get install python-pycurl which i think by default uses gnutls, but it seemed to me it should be openssl on my system.

我通过执行以下操作来解决它:

I resolved it by doing the following:

export PYCURL_SSL_LIBRARY = [openssl | gnutls | nss] (选择3,openssl,gnutls或nss之一,不带方括号)

export PYCURL_SSL_LIBRARY=[openssl|gnutls|nss] (choose one of the 3, openssl,gnutls or nss, without the brackets)

install pycurl --upgrade

如果您的pycurl版本已经是最新版本,请通过执行以下命令将其删除: pip uninstall pycurl 并运行上述命令。

If your version of pycurl is already at the newest version, remove it by executing the following command pip uninstall pycurl and run the above commands.

source: http://pycurl.sourceforge.net/doc/install.html

这篇关于PyCURL:TLS握手错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆