- curl_easy_setopt (bcsink->curl, CURLOPT_SSL_VERIFYHOST, 2L);
-
- return TRUE;
- }
-
- /* allow "insecure" SSL connections and transfers */
- if (sink->insecure) {
- curl_easy_setopt (bcsink->curl, CURLOPT_SSL_VERIFYPEER, 0L);
- curl_easy_setopt (bcsink->curl, CURLOPT_SSL_VERIFYHOST, 0L);
+ res = curl_easy_setopt (bcsink->curl, CURLOPT_SSL_VERIFYHOST, 2L);
+ if (res != CURLE_OK) {
+ bcsink->error =
+ g_strdup_printf
+ ("failed to set verification of server certificate: %s",
+ curl_easy_strerror (res));
+ return FALSE;
+ }
+ } else {
+ /* allow "insecure" SSL connections and transfers */
+ if (sink->insecure) {
+ res = curl_easy_setopt (bcsink->curl, CURLOPT_SSL_VERIFYPEER, 0L);
+ if (res != CURLE_OK) {
+ bcsink->error =
+ g_strdup_printf ("failed to set verification of peer: %s",
+ curl_easy_strerror (res));
+ return FALSE;
+ }
+
+ res = curl_easy_setopt (bcsink->curl, CURLOPT_SSL_VERIFYHOST, 0L);
+ if (res != CURLE_OK) {
+ bcsink->error =
+ g_strdup_printf
+ ("failed to set verification of server certificate: %s",
+ curl_easy_strerror (res));
+ return FALSE;
+ }
+ }