From 527d4bf00c65329d20e22da4cc4bd76ee59122d1 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 6 Jun 2019 11:03:47 +0300 Subject: [PATCH] Changed: Show server returned error message for http/404,500 errors --HG-- branch : develop --- code/nel/src/gui/group_html.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 1b3a23ce4..b2808ad14 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -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("ERROR

Connection failed

HTTP code '" + toString((sint32)code) + "'

URL '" + _CurlWWW->Url + "'

"); + } } char *ch; @@ -3880,7 +3886,7 @@ namespace NLGUI contentType = ch; } - htmlDownloadFinished(_CurlWWW->Content, contentType, code); + htmlDownloadFinished(content, contentType, code); // clear curl handler if (MultiCurl)