Check HTTP status 200 before parsing the response

This commit is contained in:
Simon Rozman 2018-09-17 08:58:02 +02:00
parent 38238d1183
commit 10c55e4ce9

View File

@ -162,9 +162,13 @@ wxXmlDocument* wxUpdCheckThread::GetCatalogue()
continue; continue;
} }
wxScopedPtr<wxInputStream> httpStream(http.GetInputStream(wxS(UPDATER_HTTP_PATH))); wxScopedPtr<wxInputStream> 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.")); wxLogStatus(_("Repository did not change since the last time."));
return NULL; 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) { } else if (!httpStream) {
wxLogWarning(_("Error response received from server %s (port %u) requesting %s."), server, UPDATER_HTTP_PORT, UPDATER_HTTP_PATH); wxLogWarning(_("Error response received from server %s (port %u) requesting %s."), server, UPDATER_HTTP_PORT, UPDATER_HTTP_PATH);
continue; continue;