mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-27 09:54:36 +02:00
Add MotD when using a broken alternate update server
This commit is contained in:
@@ -656,7 +656,7 @@ RequestStatus Client::ParseServerReturn(ByteString &result, int status, bool jso
|
||||
return RequestOkay;
|
||||
if (status != 200)
|
||||
{
|
||||
lastError = String::Build("HTTP Error ", status, ": ", ByteString(http::StatusText(status)).FromUtf8());
|
||||
lastError = String::Build("HTTP Error ", status, ": ", http::StatusText(status));
|
||||
return RequestFailure;
|
||||
}
|
||||
|
||||
@@ -686,7 +686,7 @@ RequestStatus Client::ParseServerReturn(ByteString &result, int status, bool jso
|
||||
if (!strncmp(result.c_str(), "Error: ", 7))
|
||||
{
|
||||
status = ByteString(result.begin() + 7, result.end()).ToNumber<int>();
|
||||
lastError = String::Build("HTTP Error ", status, ": ", ByteString(http::StatusText(status)).FromUtf8());
|
||||
lastError = String::Build("HTTP Error ", status, ": ", http::StatusText(status));
|
||||
return RequestFailure;
|
||||
}
|
||||
lastError = "Could not read response: " + ByteString(e.what()).FromUtf8();
|
||||
@@ -729,6 +729,8 @@ bool Client::CheckUpdate(http::Request *updateRequest, bool checkSession)
|
||||
if (status != 200)
|
||||
{
|
||||
//free(data);
|
||||
if (usingAltUpdateServer && !checkSession)
|
||||
this->messageOfTheDay = String::Build("HTTP Error ", status, " while checking for updates: ", http::StatusText(status));
|
||||
}
|
||||
else if(data.size())
|
||||
{
|
||||
@@ -1475,7 +1477,7 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
|
||||
}
|
||||
else
|
||||
{
|
||||
lastError = ByteString(http::StatusText(dataStatus)).FromUtf8();
|
||||
lastError = http::StatusText(dataStatus);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -1521,7 +1523,7 @@ std::vector<std::pair<ByteString, int> > * Client::GetTags(int start, int count,
|
||||
}
|
||||
else
|
||||
{
|
||||
lastError = ByteString(http::StatusText(dataStatus)).FromUtf8();
|
||||
lastError = http::StatusText(dataStatus);
|
||||
}
|
||||
return tagArray;
|
||||
}
|
||||
|
@@ -274,7 +274,7 @@ namespace http
|
||||
return request->Finish(status);
|
||||
}
|
||||
|
||||
const char *StatusText(int ret)
|
||||
String StatusText(int ret)
|
||||
{
|
||||
switch (ret)
|
||||
{
|
||||
|
@@ -72,7 +72,7 @@ namespace http
|
||||
static ByteString SimpleAuth(ByteString uri, int *status, ByteString ID, ByteString session, std::map<ByteString, ByteString> post_data = std::map<ByteString, ByteString>{});
|
||||
};
|
||||
|
||||
const char *StatusText(int code);
|
||||
String StatusText(int code);
|
||||
|
||||
extern const long timeout;
|
||||
extern ByteString proxy;
|
||||
|
@@ -1362,7 +1362,7 @@ int luatpt_getscript(lua_State* l)
|
||||
}
|
||||
if (ret != 200)
|
||||
{
|
||||
return luaL_error(l, http::StatusText(ret));
|
||||
return luaL_error(l, http::StatusText(ret).ToUtf8().c_str());
|
||||
}
|
||||
|
||||
if (!strcmp(scriptData.c_str(), "Invalid script ID\r\n"))
|
||||
|
Reference in New Issue
Block a user