diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 90a51ea68..b37d80272 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -118,6 +118,9 @@ namespace NLGUI // Browse error void browseError (const char *msg); + // Error message with html content + void browseErrorHtml(const std::string &html); + bool isBrowsing(); // Update coords diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index e9505abdc..eb75c1481 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -2262,6 +2262,17 @@ namespace NLGUI invalidateCoords(); } + void CGroupHTML::browseErrorHtml(const std::string &html) + { + releaseDownloads(); + removeContent(); + + renderHtmlString(html); + + updateRefreshButton(); + invalidateCoords(); + } + // *************************************************************************** bool CGroupHTML::isBrowsing() @@ -3586,11 +3597,22 @@ namespace NLGUI { if (!success) { + CUrlParser uri(_CurlWWW->Url); + + // potentially unwanted chars + std::string url = _CurlWWW->Url; + url = strFindReplaceAll(url, string("<"), string("%3C")); + url = strFindReplaceAll(url, string(">"), string("%3E")); + url = strFindReplaceAll(url, string("\""), string("%22")); + url = strFindReplaceAll(url, string("'"), string("%27")); + std::string err; - err = "Connection failed with cURL error: "; + err = "cURL error"; + err += "

Connection failed with cURL error

"; err += error; - err += "\nURL '" + _CurlWWW->Url + "'"; - browseError(err.c_str()); + err += "
(" + uri.scheme + "://" + uri.host + ") reload"; + err += ""; + browseErrorHtml(err); return; }