curl-and-python

Problems with OPT_CAINFO

From: Dario Meloni via curl-and-python <curl-and-python_at_cool.haxx.se>
Date: Thu, 6 Aug 2015 11:17:19 +0200

While developing some automated test in python I noticed I couldn't get
OPT_CAINFO to work, it was always returning error 48 (UNKNOWN OPTION).
The error is raised also while trying the example script from
http://curl.haxx.se/mail/curlpython-2010-02/att-0017/certinfo_example.py

This is happening on Ubuntu 14.04LTS. I tested with both pycurl 7.19.3
(ubuntu package), installing the latest 7.19.5.1 in python 2 and 3 with
pip/pip3 and also manually installing it.

I checked with ltrace what's the difference wrt a simple C program that was
instead working and noticed these diferences:

a.out->curl_easy_setopt(0x801510, 172, 1, 172) = 0

pycurl.cpython-34m-x86_64-linux-gnu.so->curl_easy_setopt(0xfa4c30, 172, 1,
0) = 48

the pycurl version was sending a different value as the last argument

Applying this incredibly small patch fixes it for me

--- easy.c 2015-08-06 11:12:41.334837007 +0200
+++ easy.c.orig 2015-08-06 11:12:33.070837025 +0200
@@ -1,6 +1,5 @@
 #include "pycurl.h"
 #include "docstrings.h"
-#include <curl/curl.h>

 /*************************************************************************
 // static utility functions

Dario Meloni

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2015-08-06