diff options
-rw-r--r-- | rss/exception.h | 3 | ||||
-rw-r--r-- | rss/parser.cpp | 3 | ||||
-rw-r--r-- | src/reloader.cpp | 5 |
3 files changed, 10 insertions, 1 deletions
diff --git a/rss/exception.h b/rss/exception.h index 5b0548e2f..1fc1ef33 100644 --- a/rss/exception.h +++ b/rss/exception.h @@ -16,6 +16,9 @@ private: std::string emsg; }; +class NotModifiedException : public std::exception { +}; + } // namespace rsspp #endif /* NEWSBOAT_RSSPPEXCEPTION_H_ */ diff --git a/rss/parser.cpp b/rss/parser.cpp index d837be9f..ea8dda68 100644 --- a/rss/parser.cpp +++ b/rss/parser.cpp @@ -220,6 +220,9 @@ Feed Parser::parse_url(const std::string& url, } throw Exception(msg); } + if (infoOk == CURLE_OK && status == 304) { + throw NotModifiedException(); + } const std::string buf = curlDataReceiver->get_data(); LOG(Level::DEBUG, diff --git a/src/reloader.cpp b/src/reloader.cpp index da973d45..fa628dda 100644 --- a/src/reloader.cpp +++ b/src/reloader.cpp @@ -134,11 +134,14 @@ void Reloader::reload(unsigned int pos, _("Error while retrieving %s: %s"), utils::censor_url(oldfeed->rssurl()), emsg); - } catch (rsspp::Exception& e) { + } catch (const rsspp::Exception& e) { errmsg = strprintf::fmt( _("Error while retrieving %s: %s"), utils::censor_url(oldfeed->rssurl()), e.what()); + } catch (const rsspp::NotModifiedException&) { + // Nothing to be done, feed was not chaned since last retrieve + oldfeed->set_status(DlStatus::SUCCESS); } if (!errmsg.empty()) { oldfeed->set_status(DlStatus::DL_ERROR); |