Changed: Show server returned error message for http/404,500 errors

--HG--
branch : develop
hg/ark
Nimetu 6 years ago
parent abad5aa84e
commit 527d4bf00c

@ -3827,6 +3827,9 @@ namespace NLGUI
return; return;
} }
// received content from remote
std::string content = trim(_CurlWWW->Content);
// save HSTS header from all requests regardless of HTTP code // save HSTS header from all requests regardless of HTTP code
if (_CurlWWW->hasHSTSHeader()) if (_CurlWWW->hasHSTSHeader())
{ {
@ -3868,8 +3871,11 @@ namespace NLGUI
else if ( (code < 200 || code >= 300) ) else if ( (code < 200 || code >= 300) )
{ {
// catches 304 not modified, but html is not in cache anyway // catches 304 not modified, but html is not in cache anyway
browseError(string("Connection failed\nhttp code " + toString((sint32)code) + ")\nURL '" + _CurlWWW->Url + "'").c_str()); // if server did not send any error back
return; if (content.empty())
{
content = string("<html><head><title>ERROR</title></head><body><h1>Connection failed</h1><p>HTTP code '" + toString((sint32)code) + "'</p><p>URL '" + _CurlWWW->Url + "'</p></body></html>");
}
} }
char *ch; char *ch;
@ -3880,7 +3886,7 @@ namespace NLGUI
contentType = ch; contentType = ch;
} }
htmlDownloadFinished(_CurlWWW->Content, contentType, code); htmlDownloadFinished(content, contentType, code);
// clear curl handler // clear curl handler
if (MultiCurl) if (MultiCurl)

Loading…
Cancel
Save