From 6f04970280311f128df2098cd949ab5adb77dae4 Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Wed, 31 Jan 2018 19:57:07 +0100 Subject: [PATCH] RSSyl: Handle 404 and other fetch failures better. --- src/plugins/rssyl/libfeed/feed.c | 2 -- src/plugins/rssyl/rssyl_update_feed.c | 12 +++++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/rssyl/libfeed/feed.c b/src/plugins/rssyl/libfeed/feed.c index c88f87bd9..ceb14bf8f 100644 --- a/src/plugins/rssyl/libfeed/feed.c +++ b/src/plugins/rssyl/libfeed/feed.c @@ -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; - } else if (!feed->is_valid) { - response_code = FEED_ERR_NOFEED; } else { curl_easy_getinfo(eh, CURLINFO_RESPONSE_CODE, &response_code); } diff --git a/src/plugins/rssyl/rssyl_update_feed.c b/src/plugins/rssyl/rssyl_update_feed.c index 6ecfeb373..d85288db7 100644 --- a/src/plugins/rssyl/rssyl_update_feed.c +++ b/src/plugins/rssyl/rssyl_update_feed.c @@ -90,6 +90,8 @@ void rssyl_fetch_feed(RFetchCtx *ctx, RSSylVerboseFlags verbose) 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"); @@ -249,6 +251,14 @@ gboolean rssyl_update_feed(RFolderItem *ritem, RSSylVerboseFlags verbose) 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 */ @@ -273,7 +283,7 @@ gboolean rssyl_update_feed(RFolderItem *ritem, RSSylVerboseFlags verbose) feed_free(ctx->feed); g_free(ctx->error); g_free(ctx); - return success; + return FALSE; } if( ritem->fetch_comments ) -- 2.25.1