diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 590c43a89..a78e203c0 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -115,6 +115,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/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index e88bdfbc5..ae8722592 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -2642,6 +2642,17 @@ namespace NLGUI invalidateCoords(); } + void CGroupHTML::browseErrorHtml(const std::string &html) + { + releaseDownloads(); + removeContent(); + + renderHtmlString(html); + + updateRefreshButton(); + invalidateCoords(); + } + // *************************************************************************** bool CGroupHTML::isBrowsing() @@ -3964,11 +3975,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; } diff --git a/code/ryzom/client/src/network_connection.cpp b/code/ryzom/client/src/network_connection.cpp index 731677043..4778641c0 100644 --- a/code/ryzom/client/src/network_connection.cpp +++ b/code/ryzom/client/src/network_connection.cpp @@ -680,6 +680,7 @@ bool CNetworkConnection::connect(string &result) _LatestLoginTime = ryzomGetLocalTime (); _LatestSyncTime = _LatestLoginTime; _LatestProbeTime = _LatestLoginTime; + m_LoginAttempts = 0; nlinfo("CNET[%p]: Client connected to shard, attempting login", this); return true; @@ -1091,6 +1092,17 @@ bool CNetworkConnection::stateLogin() { sendSystemLogin(); _LatestLoginTime = _UpdateTime; + if (m_LoginAttempts > 24) + { + m_LoginAttempts = 0; + disconnect(); // will send disconnection message + nlwarning("CNET[%p]: Too many LOGIN attempts, connection problem", this); + return false; // exit now from loop, don't expect a new state + } + else + { + ++m_LoginAttempts; + } } return false; @@ -2308,6 +2320,7 @@ bool CNetworkConnection::stateProbe() else { nlwarning("CNET[%p]: received normal in state Probe", this); + _LatestProbeTime = _UpdateTime; } } } diff --git a/code/ryzom/client/src/network_connection.h b/code/ryzom/client/src/network_connection.h index d11702682..84bb26d43 100644 --- a/code/ryzom/client/src/network_connection.h +++ b/code/ryzom/client/src/network_connection.h @@ -822,6 +822,7 @@ private: void sendSystemLogin(); bool stateLogin(); NLMISC::TTime _LatestLoginTime; + int m_LoginAttempts; // void receiveSystemSync(NLMISC::CBitMemStream &msgin);