|
|
|
@ -155,7 +155,8 @@ CLoginStateMachine LoginSM;
|
|
|
|
|
|
|
|
|
|
bool CStartupHttpClient::connectToLogin()
|
|
|
|
|
{
|
|
|
|
|
return connect(ClientCfg.ConfigFile.getVar("StartupHost").asString(0));
|
|
|
|
|
return connect(ClientCfg.ConfigFile.getVar("StartupHost").asString(0))
|
|
|
|
|
&& verifyServer(ClientCfg.ConfigFile.getVar("StartupVerify").asBool(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CStartupHttpClient HttpClient;
|
|
|
|
@ -2825,7 +2826,36 @@ string checkLogin(const string &login, const string &password, const string &cli
|
|
|
|
|
if(res.empty())
|
|
|
|
|
return "Empty answer from server (error code 62)";
|
|
|
|
|
|
|
|
|
|
if(res[0] == '0')
|
|
|
|
|
size_t first = res.find("\n\n");
|
|
|
|
|
if (first == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
first = res.find("\r\r");
|
|
|
|
|
if (first == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
first = res.find("\r\n\r\n");
|
|
|
|
|
if (first != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nldebug("res1: %s", res.c_str());
|
|
|
|
|
|
|
|
|
|
if (res[0] == 'H')
|
|
|
|
|
{
|
|
|
|
|
nlwarning("missing response body: %s", res.c_str());
|
|
|
|
|
return "missing response body (error code 64)";
|
|
|
|
|
}
|
|
|
|
|
else if(res[0] == '0')
|
|
|
|
|
{
|
|
|
|
|
// server returns an error
|
|
|
|
|
nlwarning("server error: %s", res.substr(2).c_str());
|
|
|
|
@ -2878,7 +2908,36 @@ string checkLogin(const string &login, const string &password, const string &cli
|
|
|
|
|
if(res.empty())
|
|
|
|
|
return "Empty answer from server (error code 4)";
|
|
|
|
|
|
|
|
|
|
if(res[0] == '0')
|
|
|
|
|
size_t first = res.find("\n\n");
|
|
|
|
|
if (first == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
first = res.find("\r\r");
|
|
|
|
|
if (first == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
first = res.find("\r\n\r\n");
|
|
|
|
|
if (first != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nldebug("res2: %s", res.c_str());
|
|
|
|
|
|
|
|
|
|
if (res[0] == 'H')
|
|
|
|
|
{
|
|
|
|
|
nlwarning("missing response body: %s", res.c_str());
|
|
|
|
|
return "missing response body (error code 65)";
|
|
|
|
|
}
|
|
|
|
|
else if(res[0] == '0')
|
|
|
|
|
{
|
|
|
|
|
// server returns an error
|
|
|
|
|
nlwarning("server error: %s", res.substr(2).c_str());
|
|
|
|
@ -2960,7 +3019,36 @@ string checkLogin(const string &login, const string &password, const string &cli
|
|
|
|
|
if(res.empty())
|
|
|
|
|
return "Empty answer from server (error code 4)";
|
|
|
|
|
|
|
|
|
|
if(res[0] == '0')
|
|
|
|
|
size_t first = res.find("\n\n");
|
|
|
|
|
if (first == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
first = res.find("\r\r");
|
|
|
|
|
if (first == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
first = res.find("\r\n\r\n");
|
|
|
|
|
if (first != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nldebug("res2: %s", res.c_str());
|
|
|
|
|
|
|
|
|
|
if (res[0] == 'H')
|
|
|
|
|
{
|
|
|
|
|
nlwarning("missing response body: %s", res.c_str());
|
|
|
|
|
return "missing response body (error code 66)";
|
|
|
|
|
}
|
|
|
|
|
else if(res[0] == '0')
|
|
|
|
|
{
|
|
|
|
|
// server returns an error
|
|
|
|
|
nlwarning("server error: %s", res.substr(2).c_str());
|
|
|
|
@ -3065,7 +3153,36 @@ string selectShard(uint32 shardId, string &cookie, string &addr)
|
|
|
|
|
if(res.empty())
|
|
|
|
|
return "Empty result (error code 13)";
|
|
|
|
|
|
|
|
|
|
if(res[0] == '0')
|
|
|
|
|
size_t first = res.find("\n\n");
|
|
|
|
|
if (first == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
first = res.find("\r\r");
|
|
|
|
|
if (first == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
first = res.find("\r\n\r\n");
|
|
|
|
|
if (first != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
res = res.substr(first + 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nldebug("res2: %s", res.c_str());
|
|
|
|
|
|
|
|
|
|
if (res[0] == 'H')
|
|
|
|
|
{
|
|
|
|
|
nlwarning("missing response body: %s", res.c_str());
|
|
|
|
|
return "missing response body (error code 66)";
|
|
|
|
|
}
|
|
|
|
|
else if(res[0] == '0')
|
|
|
|
|
{
|
|
|
|
|
// server returns an error
|
|
|
|
|
nlwarning("server error: %s", res.substr(2).c_str());
|
|
|
|
|