mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 15:01:16 +01:00
UICommon/NetPlayIndex: Handle non 200 HTTP return codes
This commit is contained in:
parent
eddcb70b84
commit
336edbef1e
@ -56,7 +56,8 @@ NetPlayIndex::List(const std::map<std::string, std::string>& filters)
|
|||||||
list_url.pop_back();
|
list_url.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto response = request.Get(list_url, {{"X-Is-Dolphin", "1"}});
|
auto response =
|
||||||
|
request.Get(list_url, {{"X-Is-Dolphin", "1"}}, Common::HttpRequest::AllowedReturnCodes::All);
|
||||||
if (!response)
|
if (!response)
|
||||||
{
|
{
|
||||||
m_last_error = "NO_RESPONSE";
|
m_last_error = "NO_RESPONSE";
|
||||||
@ -132,7 +133,7 @@ void NetPlayIndex::NotificationLoop()
|
|||||||
Config::Get(Config::NETPLAY_INDEX_URL) + "/v0/session/active?secret=" + m_secret +
|
Config::Get(Config::NETPLAY_INDEX_URL) + "/v0/session/active?secret=" + m_secret +
|
||||||
"&player_count=" + std::to_string(m_player_count) +
|
"&player_count=" + std::to_string(m_player_count) +
|
||||||
"&game=" + request.EscapeComponent(m_game) + "&in_game=" + std::to_string(m_in_game),
|
"&game=" + request.EscapeComponent(m_game) + "&in_game=" + std::to_string(m_in_game),
|
||||||
{{"X-Is-Dolphin", "1"}});
|
{{"X-Is-Dolphin", "1"}}, Common::HttpRequest::AllowedReturnCodes::All);
|
||||||
|
|
||||||
if (!response)
|
if (!response)
|
||||||
continue;
|
continue;
|
||||||
@ -162,17 +163,16 @@ void NetPlayIndex::NotificationLoop()
|
|||||||
bool NetPlayIndex::Add(NetPlaySession session)
|
bool NetPlayIndex::Add(NetPlaySession session)
|
||||||
{
|
{
|
||||||
Common::HttpRequest request;
|
Common::HttpRequest request;
|
||||||
auto response = request.Get(Config::Get(Config::NETPLAY_INDEX_URL) +
|
auto response = request.Get(
|
||||||
"/v0/session/add?name=" + request.EscapeComponent(session.name) +
|
Config::Get(Config::NETPLAY_INDEX_URL) +
|
||||||
"®ion=" + request.EscapeComponent(session.region) +
|
"/v0/session/add?name=" + request.EscapeComponent(session.name) +
|
||||||
"&game=" + request.EscapeComponent(session.game_id) +
|
"®ion=" + request.EscapeComponent(session.region) +
|
||||||
"&password=" + std::to_string(session.has_password) +
|
"&game=" + request.EscapeComponent(session.game_id) +
|
||||||
"&method=" + session.method + "&server_id=" + session.server_id +
|
"&password=" + std::to_string(session.has_password) + "&method=" + session.method +
|
||||||
"&in_game=" + std::to_string(session.in_game) +
|
"&server_id=" + session.server_id + "&in_game=" + std::to_string(session.in_game) +
|
||||||
"&port=" + std::to_string(session.port) +
|
"&port=" + std::to_string(session.port) + "&player_count=" +
|
||||||
"&player_count=" + std::to_string(session.player_count) +
|
std::to_string(session.player_count) + "&version=" + Common::scm_desc_str,
|
||||||
"&version=" + Common::scm_desc_str,
|
{{"X-Is-Dolphin", "1"}}, Common::HttpRequest::AllowedReturnCodes::All);
|
||||||
{{"X-Is-Dolphin", "1"}});
|
|
||||||
|
|
||||||
if (!response.has_value())
|
if (!response.has_value())
|
||||||
{
|
{
|
||||||
@ -239,7 +239,7 @@ void NetPlayIndex::Remove()
|
|||||||
// We don't really care whether this fails or not
|
// We don't really care whether this fails or not
|
||||||
Common::HttpRequest request;
|
Common::HttpRequest request;
|
||||||
request.Get(Config::Get(Config::NETPLAY_INDEX_URL) + "/v0/session/remove?secret=" + m_secret,
|
request.Get(Config::Get(Config::NETPLAY_INDEX_URL) + "/v0/session/remove?secret=" + m_secret,
|
||||||
{{"X-Is-Dolphin", "1"}});
|
{{"X-Is-Dolphin", "1"}}, Common::HttpRequest::AllowedReturnCodes::All);
|
||||||
|
|
||||||
m_secret.clear();
|
m_secret.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user