Hi,

Here is a patch that adds a function to enable or disable libcurl verification 
of 
the peer's certificate authenticity. It's usefull to disable it when you do 
requests to web servers with sefl-signed certificates.

The attached patch adds the function to the API.

Please apply.

-- 
------------------------
Raoul Hecky
Calaos
Index: src/lib/ecore_con/ecore_con_url.c
===================================================================
--- src/lib/ecore_con/ecore_con_url.c	(révision 57406)
+++ src/lib/ecore_con/ecore_con_url.c	(copie de travail)
@@ -1403,6 +1403,42 @@
 }
 
 /**
+ * Toggle libcurl's verify peer's certificate option.
+ *
+ * If @p verify is @c EINA_TRUE, libcurl will verify
+ * the authenticity of the peer's certificate, otherwise
+ * it will not. Default behavior of libcurl is to check
+ * peer's certificate.
+ *
+ * @param url_con Ecore_Con_Url instance which will be acted upon.
+ * @param verify Whether or not libcurl will check peer's certificate.
+ */
+EAPI void
+ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con,
+                              Eina_Bool      verify)
+{
+#ifdef HAVE_CURL
+   if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
+     {
+        ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
+                         "ecore_con_url_ssl_verify_peer_set");
+        return;
+     }
+
+   if (url_con->active)
+     return;
+
+   if (!url_con->url)
+     return;
+
+   curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, (int)verify);
+#else
+   (void)url_con;
+   (void)verify;
+#endif
+}
+
+/**
  * @}
  */
 
Index: src/lib/ecore_con/Ecore_Con.h
===================================================================
--- src/lib/ecore_con/Ecore_Con.h	(révision 57406)
+++ src/lib/ecore_con/Ecore_Con.h	(copie de travail)
@@ -577,6 +577,9 @@
                                                           const char * const cookiejar_file);
 EAPI void              ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con);
 
+EAPI void              ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con,
+                                                         Eina_Bool verify);
+
 /**
  * @}
  */
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to