From 10c55e4ce93a6e12e1af459dd5a89d73b87da3ab Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 17 Sep 2018 08:58:02 +0200 Subject: [PATCH] Check HTTP status 200 before parsing the response --- Updater/src/chkthread.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Updater/src/chkthread.cpp b/Updater/src/chkthread.cpp index 1bd6c19..6c1f2e6 100644 --- a/Updater/src/chkthread.cpp +++ b/Updater/src/chkthread.cpp @@ -162,9 +162,13 @@ wxXmlDocument* wxUpdCheckThread::GetCatalogue() continue; } wxScopedPtr httpStream(http.GetInputStream(wxS(UPDATER_HTTP_PATH))); - if (http.GetResponse() == 304) { + int status = http.GetResponse(); + if (status == 304) { wxLogStatus(_("Repository did not change since the last time.")); return NULL; + } else if (status != 200) { + wxLogWarning(_("%u status received from server %s (port %u) requesting %s."), status, server, UPDATER_HTTP_PORT, UPDATER_HTTP_PATH); + continue; } else if (!httpStream) { wxLogWarning(_("Error response received from server %s (port %u) requesting %s."), server, UPDATER_HTTP_PORT, UPDATER_HTTP_PATH); continue;