Skip to content
Permalink
Browse files

Add MotD when using a broken alternate update server

  • Loading branch information...
jacob1 committed Mar 23, 2019
1 parent e07b133 commit c7ae820f1cb621239f1f3602d6164479598f50d1
Showing with 9 additions and 7 deletions.
  1. +6 −4 src/client/Client.cpp
  2. +1 −1 src/client/http/Request.cpp
  3. +1 −1 src/client/http/Request.h
  4. +1 −1 src/lua/LegacyLuaAPI.cpp
@@ -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"))

0 comments on commit c7ae820

Please sign in to comment.
You can’t perform that action at this time.