Changed: Show server returned error message for http/404,500 errors
--HG-- branch : develop
This commit is contained in:
parent
abad5aa84e
commit
527d4bf00c
1 changed files with 9 additions and 3 deletions
|
@ -3827,6 +3827,9 @@ namespace NLGUI
|
|||
return;
|
||||
}
|
||||
|
||||
// received content from remote
|
||||
std::string content = trim(_CurlWWW->Content);
|
||||
|
||||
// save HSTS header from all requests regardless of HTTP code
|
||||
if (_CurlWWW->hasHSTSHeader())
|
||||
{
|
||||
|
@ -3868,8 +3871,11 @@ namespace NLGUI
|
|||
else if ( (code < 200 || code >= 300) )
|
||||
{
|
||||
// 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());
|
||||
return;
|
||||
// if server did not send any error back
|
||||
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;
|
||||
|
@ -3880,7 +3886,7 @@ namespace NLGUI
|
|||
contentType = ch;
|
||||
}
|
||||
|
||||
htmlDownloadFinished(_CurlWWW->Content, contentType, code);
|
||||
htmlDownloadFinished(content, contentType, code);
|
||||
|
||||
// clear curl handler
|
||||
if (MultiCurl)
|
||||
|
|
Loading…
Reference in a new issue