RSSyl: Use our CA certificate bundle on Windows.
[claws.git] / src / plugins / rssyl / rssyl_update_feed.c
index 63b0c6f9ecd73628e3fa2d998c71fe45d08d288d..0f336169063de2b09f959cbad633721d09d7d6bc 100644 (file)
@@ -96,6 +96,9 @@ void rssyl_fetch_feed(RFetchCtx *ctx, gboolean verbose)
        } else if( ctx->response_code == FEED_ERR_FETCH ) {
                debug_print("RSSyl: libfeed reports some other error from libcurl\n");
                ctx->error = g_strdup(ctx->feed->fetcherr);
+       } else if( ctx->response_code == FEED_ERR_UNAUTH ) {
+               debug_print("RSSyl: URL authorization type is unknown\n");
+               ctx->error = g_strdup("Unknown value for URL authorization type");
        } else if( ctx->response_code >= 400 && ctx->response_code < 500 ) {
                switch( ctx->response_code ) {
                        case 401:
@@ -165,6 +168,13 @@ RFetchCtx *rssyl_prep_fetchctx_from_item(RFolderItem *ritem)
        feed_set_timeout(ctx->feed, prefs_common.io_timeout_secs);
        feed_set_cookies_path(ctx->feed, rssyl_prefs_get()->cookies_path);
        feed_set_ssl_verify_peer(ctx->feed, ritem->ssl_verify_peer);
+       feed_set_auth(ctx->feed, ritem->auth);
+#ifdef G_OS_WIN32
+       if (!g_ascii_strncasecmp(ritem->url, "https", 5)) {
+               feed_set_cacert_file(ctx->feed, claws_ssl_get_cert_file());
+               debug_print("RSSyl: using cert file '%s'\n", feed_get_cacert_file(ctx->feed));
+       }
+#endif
 
        return ctx;
 }
@@ -184,6 +194,12 @@ RFetchCtx *rssyl_prep_fetchctx_from_url(gchar *url)
        feed_set_timeout(ctx->feed, prefs_common.io_timeout_secs);
        feed_set_cookies_path(ctx->feed, rssyl_prefs_get()->cookies_path);
        feed_set_ssl_verify_peer(ctx->feed, rssyl_prefs_get()->ssl_verify_peer);
+#ifdef G_OS_WIN32
+       if (!g_ascii_strncasecmp(ritem->url, "https", 5)) {
+               feed_set_cacert_file(ctx->feed, claws_ssl_get_cert_file());
+               debug_print("RSSyl: using cert file '%s'\n", feed_get_cacert_file(ctx->feed));
+       }
+#endif
 
        return ctx;
 }