diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index bf0d3439fb..e60f70972c 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/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. diff --git a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h b/legacy/ecore/src/lib/ecore_con/Ecore_Con.h index 753e19d3a3..b8fbad89a5 100644 --- a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h +++ b/legacy/ecore/src/lib/ecore_con/Ecore_Con.h @@ -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); + /** * @} */ diff --git a/legacy/ecore/src/lib/ecore_con/ecore_con_url.c b/legacy/ecore/src/lib/ecore_con/ecore_con_url.c index c85f190927..33c38a3b01 100644 --- a/legacy/ecore/src/lib/ecore_con/ecore_con_url.c +++ b/legacy/ecore/src/lib/ecore_con/ecore_con_url.c @@ -1402,6 +1402,42 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, (void)use_epsv; } +/** + * 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 +} + /** * @} */