RSSyl: Handle 404 and other fetch failures better.
authorAndrej Kacian <ticho@claws-mail.org>
Wed, 31 Jan 2018 18:57:07 +0000 (19:57 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Wed, 31 Jan 2018 18:57:07 +0000 (19:57 +0100)
src/plugins/rssyl/libfeed/feed.c
src/plugins/rssyl/rssyl_update_feed.c

index c88f87bd92869b69d7c42b5f8cdd22004fc5e698..ceb14bf8fbc255e71bf313727597fd629cc953c2 100644 (file)
@@ -340,8 +340,6 @@ guint feed_update(Feed *feed, time_t last_update)
        if( res != CURLE_OK ) {
                feed->fetcherr = g_strdup(curl_easy_strerror(res));
                response_code = FEED_ERR_FETCH;
        if( res != CURLE_OK ) {
                feed->fetcherr = g_strdup(curl_easy_strerror(res));
                response_code = FEED_ERR_FETCH;
-       } else if (!feed->is_valid) {
-               response_code = FEED_ERR_NOFEED;
        } else {
                curl_easy_getinfo(eh, CURLINFO_RESPONSE_CODE, &response_code);
        }
        } else {
                curl_easy_getinfo(eh, CURLINFO_RESPONSE_CODE, &response_code);
        }
index 6ecfeb37377440bf3ab1c195a08de8a8ff9ff556..d85288db7b7c4dfeb23f9346c0a3c84fa4dcfe00 100644 (file)
@@ -90,6 +90,8 @@ void rssyl_fetch_feed(RFetchCtx *ctx, RSSylVerboseFlags verbose)
        rssyl_fetch_feed_thr(ctx);
 #endif
 
        rssyl_fetch_feed_thr(ctx);
 #endif
 
+       debug_print("RSSyl: got response_code %d\n", ctx->response_code);
+
        if( ctx->response_code == FEED_ERR_INIT ) {
                debug_print("RSSyl: libfeed reports init error from libcurl\n");
                ctx->error = g_strdup("Internal error");
        if( ctx->response_code == FEED_ERR_INIT ) {
                debug_print("RSSyl: libfeed reports init error from libcurl\n");
                ctx->error = g_strdup("Internal error");
@@ -249,6 +251,14 @@ gboolean rssyl_update_feed(RFolderItem *ritem, RSSylVerboseFlags verbose)
        debug_print("RSSyl: fetch done; success == %s\n",
                        ctx->success ? "TRUE" : "FALSE");
 
        debug_print("RSSyl: fetch done; success == %s\n",
                        ctx->success ? "TRUE" : "FALSE");
 
+       if (!ctx->success) {
+               feed_free(ctx->feed);
+               g_free(ctx->error);
+               g_free(ctx);
+               STATUSBAR_POP(mainwin);
+               return ctx->success;
+       }
+
        debug_print("RSSyl: STARTING TO PARSE FEED\n");
   if( ctx->success && !(ctx->success = rssyl_parse_feed(ritem, ctx->feed)) ) {
                /* both libcurl and libfeed were happy, but we weren't */
        debug_print("RSSyl: STARTING TO PARSE FEED\n");
   if( ctx->success && !(ctx->success = rssyl_parse_feed(ritem, ctx->feed)) ) {
                /* both libcurl and libfeed were happy, but we weren't */
@@ -273,7 +283,7 @@ gboolean rssyl_update_feed(RFolderItem *ritem, RSSylVerboseFlags verbose)
                feed_free(ctx->feed);
                g_free(ctx->error);
                g_free(ctx);
                feed_free(ctx->feed);
                g_free(ctx->error);
                g_free(ctx);
-               return success;
+               return FALSE;
        }
 
        if( ritem->fetch_comments )
        }
 
        if( ritem->fetch_comments )