curl-and-python

Re: curl-and-python Digest, Vol 60, Issue 2

From: Michael Wood <esiotrot_at_gmail.com>
Date: Thu, 18 Aug 2011 09:01:19 +0200

On 16 August 2011 17:22, John Skopis <jskopis_at_lakeshoreint.com> wrote:
> On 08/16/2011 05:00 AM, curl-and-python-request_at_cool.haxx.se wrote:
>>>
>>> I am wondering if you know of a better way to initialize setup CAINFO to
>>> >  something useful besides hardcoding the path in do_curl_new. Running
>>> > strings
>>> >  on libcurl reveals the path to CAINFO.
>>
>> libcurl has a default path for CAINFO set internally. If you need to
>> change
>> that then it is entirely up to your app how to do it!
>
> The app is pycurl. Running the test below fails because CAINFO is set to
> None in pycurl.
>
> I am wondering what is the best way to initialize pycurl.CAINFO, using the
> library default?
>
> If you look at the earlier code, I had hardcoded setting the path in the
> pycurl Curl constructor. Rather than hardcoding the path I think it makes
> more sense to ask libcurl for the default path.
>
> Or, did I compile libcurl incorrectly? Is curl supposed to use the deafult
> if CAINFO/CAPATH is not set?

Your script works fine for me on Ubuntu 10.04:

$ python /tmp/test.py
Testing libcurl/7.19.7 GnuTLS/2.8.5 zlib/1.2.3.3 libidn/1.15
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://encrypted.google.com/">here</A>.
</BODY></HTML>

I thought the following might be a workaround for you:

c.unsetopt(pycurl.CAINFO)

but when I try it here I get:

Traceback (most recent call last):
  File "/tmp/test.py", line 18, in <module>
    c.perform()
pycurl.error: (60, 'server certificate verification failed. CAfile:
none CRLfile: none')

-- 
Michael Wood <esiotrot_at_gmail.com>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2011-08-18