ecore: add ecore_con_url_ssl_verify_peer_set patch by Raoul Hecky.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 1 Mar 2011 09:51:51 +0000 (09:51 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 1 Mar 2011 09:51:51 +0000 (09:51 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@57448 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/ecore_con/Ecore_Con.h
src/lib/ecore_con/ecore_con_url.c

index bf0d343..e60f709 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -72,3 +72,7 @@
 2011-02-27 Jihoon Kim
 
         * Add ecore_imf_context_preedit_string_with_attributes_get API.
+
+2011-03-01 Raoul Hecky
+
+       * Add ecore_con_url_ssl_verify_peer_set API.
index 753e19d..b8fbad8 100644 (file)
@@ -577,6 +577,9 @@ EAPI Eina_Bool         ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con
                                                           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);
+
 /**
  * @}
  */
index c85f190..33c38a3 100644 (file)
@@ -1403,6 +1403,42 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con,
 }
 
 /**
+ * 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
+}
+
+/**
  * @}
  */