commit 6f04970280311f128df2098cd949ab5adb77dae4
parent 93eaaa941d8914bfc95d0b77da0f698dc719bcbd
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Wed, 31 Jan 2018 19:57:07 +0100
RSSyl: Handle 404 and other fetch failures better.
Diffstat:
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git 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
@@ -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 )