Skip to content

Commit 355aaaa

Browse files
committed
Revert "Update config to use the new online servers. Remove hardcoded certificate as we will use Let's encrypt from now on (supertuxkart#3690)"
This reverts commit ed225a2.
1 parent ed225a2 commit 355aaaa

File tree

8 files changed

+79
-79
lines changed

8 files changed

+79
-79
lines changed

data/addons.supertuxkart.net.pem

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDezCCAmOgAwIBAgIJAO+A8uXtEMRsMA0GCSqGSIb3DQEBCwUAMFQxCzAJBgNV
3+
BAYTAlVTMQwwCgYDVQQIDANTVEsxFTATBgNVBAoMDFN1cGVyVHV4S2FydDEgMB4G
4+
A1UEAwwXYWRkb25zLnN1cGVydHV4a2FydC5uZXQwHhcNMTQxMjEwMTEzMTAwWhcN
5+
MjQxMjA3MTEzMTAwWjBUMQswCQYDVQQGEwJVUzEMMAoGA1UECAwDU1RLMRUwEwYD
6+
VQQKDAxTdXBlclR1eEthcnQxIDAeBgNVBAMMF2FkZG9ucy5zdXBlcnR1eGthcnQu
7+
bmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2ysZE9rb4y0tHOhk
8+
wxYpqsvDv5LCRFTAeyfAfyBVDcOn+4A3sX8MkQdoH/QDi823z4bn9ZsGV8T444FN
9+
S4yK/aSRv3eAKkkJm5TUxbs3crATVt3JYusMr5W4wHvRVyDe0DlulSdW4EUEklMP
10+
iPat/jwlDZRvZueio3wJoOhZXnl8E8EfnuYtlNONIB1nYGdUHD9xeNyKSPr4zTEp
11+
brjvSw0l5G88LmQOROQBDbTDknAcIQwsFT1mf9Bt+N9LK14r95GWRmL3ZtfbrJn4
12+
ZEfkOjl0Abv6gET4sQOXv0KioUdEJwzFCwKFLZVcuOrscmcHBOhgD3EruVvprIJ0
13+
wZ3z1wIDAQABo1AwTjAdBgNVHQ4EFgQUmQwaPsD+ylVUUsUXMAYpUlnVbNwwHwYD
14+
VR0jBBgwFoAUmQwaPsD+ylVUUsUXMAYpUlnVbNwwDAYDVR0TBAUwAwEB/zANBgkq
15+
hkiG9w0BAQsFAAOCAQEASyl6BMpnZhJlirDL84/RkVeVjBkr7x68UFAblmKjgfGg
16+
pRbYPNSld0IrfZ4pcrDAUkg9WJb0Zxuh0oYiV+RjdW/6s5mF/qiSv8V60xb2myRd
17+
z90ZGfhB5SAECI5zfIZSmsMjOEjKjuz8S26aEtJe8Vq7GF2P7/889lfNXrbvIkZX
18+
HQpx2P+T07zy++6Ca/K2vmWcf1a+GrN+o0nZTYbz/2r/JJwXdWqT1ZmtEA9GNwvZ
19+
J8HhgvspgjgVP/EURUUhOaQ8zfhriU5CJAIuhMhzW7oOBPHxxtxme3auAfxi5zpK
20+
wRNluCayrrjhy2I8mABRnBqgMwAQUIrgk9IU6SyQxw==
21+
-----END CERTIFICATE-----

data/stk_config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
<minimap size="180.0" ai-icon="16.0" player-icon="20.0"/>
158158

159159
<urls donate="https://supertuxkart.net/Donate"
160-
password-reset="https://online.supertuxkart.net/password-reset.php" />
160+
password-reset="http://addons.supertuxkart.net/password-reset.php" />
161161

162162
<!-- Skidmark data: maximum number of skid marks, and
163163
time for skidmarks to fade out. Maximum number will over

src/config/user_config.hpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,15 @@ class MapUserConfigParam : public UserConfigParam
152152
}
153153
std::map<T, U>& operator=(const std::map<T,U>& v)
154154
{
155-
m_elements = std::map<T, U>(v);
155+
m_elements = std::map<T, U>(v);
156156
return m_elements;
157157
}
158158
std::map<T, U>& operator=(const MapUserConfigParam& v)
159159
{
160-
m_elements = std::map<T,U>(v);
160+
m_elements = std::map<T,U>(v);
161161
return m_elements;
162162
}
163-
U& operator[] (const T key)
163+
U& operator[] (const T key)
164164
{
165165
return m_elements[key];
166166
}
@@ -443,7 +443,7 @@ namespace UserConfigParams
443443
PARAM_PREFIX StringUserConfigParam m_last_used_kart_group
444444
PARAM_DEFAULT( StringUserConfigParam("all", "last_kart_group",
445445
"Last selected kart group") );
446-
446+
447447
// ---- Wiimote data
448448
PARAM_PREFIX GroupUserConfigParam m_wiimote_group
449449
PARAM_DEFAULT( GroupUserConfigParam("WiiMote",
@@ -482,7 +482,7 @@ namespace UserConfigParams
482482
PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_enabled",
483483
&m_multitouch_group,
484484
"Enable multitouch support.") );
485-
485+
486486
PARAM_PREFIX IntUserConfigParam m_multitouch_mode
487487
PARAM_DEFAULT( IntUserConfigParam(1, "multitouch_mode",
488488
&m_multitouch_group,
@@ -508,12 +508,12 @@ namespace UserConfigParams
508508
PARAM_DEFAULT( FloatUserConfigParam(0.2f, "multitouch_sensitivity_x",
509509
&m_multitouch_group,
510510
"A parameter in range [0, 1.0] that determines the sensitivity for x axis."));
511-
511+
512512
PARAM_PREFIX FloatUserConfigParam m_multitouch_sensitivity_y
513513
PARAM_DEFAULT( FloatUserConfigParam(0.65f, "multitouch_sensitivity_y",
514514
&m_multitouch_group,
515515
"A parameter in range [0, 1.0] that determines the sensitivity for y axis."));
516-
516+
517517
PARAM_PREFIX FloatUserConfigParam m_multitouch_tilt_factor
518518
PARAM_DEFAULT( FloatUserConfigParam(4.0f, "multitouch_tilt_factor",
519519
&m_multitouch_group,
@@ -530,7 +530,7 @@ namespace UserConfigParams
530530
&m_multitouch_group,
531531
"Screen keyboard mode: 0 = disabled, 1 = enabled if no hardware "
532532
"keyboard, 2 = always enabled, 3 = android keyboard (experimental)") );
533-
533+
534534
PARAM_PREFIX BoolUserConfigParam m_hidpi_enabled
535535
PARAM_DEFAULT( BoolUserConfigParam(false, "hidpi_enabled",
536536
&m_multitouch_group,
@@ -728,7 +728,7 @@ namespace UserConfigParams
728728
PARAM_PREFIX bool m_race_now PARAM_DEFAULT( false );
729729

730730
PARAM_PREFIX bool m_enforce_current_player PARAM_DEFAULT( false );
731-
731+
732732
PARAM_PREFIX bool m_enable_sound PARAM_DEFAULT( true );
733733

734734
/** True to test funky ambient/diffuse/specularity in RGB &
@@ -953,9 +953,8 @@ namespace UserConfigParams
953953
PARAM_DEFAULT( IntUserConfigParam(0, "random-identifier", &m_hw_report_group,
954954
"A random number to avoid duplicated reports.") );
955955

956-
// TODO change new-stats to stats before release
957956
PARAM_PREFIX StringUserConfigParam m_server_hw_report
958-
PARAM_DEFAULT( StringUserConfigParam( "https://new-stats.supertuxkart.net",
957+
PARAM_DEFAULT( StringUserConfigParam( "http://addons.supertuxkart.net:8080",
959958
"hw-report-server",
960959
&m_hw_report_group,
961960
"The server used for reporting statistics to."));
@@ -979,7 +978,7 @@ namespace UserConfigParams
979978
"Everything related to online play.") );
980979

981980
PARAM_PREFIX StringUserConfigParam m_server_multiplayer
982-
PARAM_DEFAULT( StringUserConfigParam( "https://online.supertuxkart.net/api/",
981+
PARAM_DEFAULT( StringUserConfigParam( "https://addons.supertuxkart.net/api/",
983982
"server_multiplayer",
984983
&m_online_group,
985984
"The server used for online multiplayer."));
@@ -997,7 +996,7 @@ namespace UserConfigParams
997996
"Addon and news related settings") );
998997

999998
PARAM_PREFIX StringUserConfigParam m_server_addons
1000-
PARAM_DEFAULT( StringUserConfigParam("https://online.supertuxkart.net/dl/xml",
999+
PARAM_DEFAULT( StringUserConfigParam("http://addons.supertuxkart.net/dl/xml",
10011000
"server_addons",
10021001
&m_addon_group,
10031002
"The server used for addon."));
@@ -1045,7 +1044,7 @@ namespace UserConfigParams
10451044
PARAM_DEFAULT( IntUserConfigParam(0, "unlock_everything",
10461045
"Enable all karts and tracks: 0 = disabled, "
10471046
"1 = everything except final race, 2 = everything") );
1048-
1047+
10491048
PARAM_PREFIX StringUserConfigParam m_commandline
10501049
PARAM_DEFAULT( StringUserConfigParam("", "commandline",
10511050
"Allows to set commandline args in config file") );

src/io/file_manager.cpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ FileManager* file_manager = 0;
115115
/** The constructor of the file manager creates an irrlicht file system and
116116
* detects paths for the user config file and assets base directory (data).
117117
* A second initialisation is done later once (see init()), once the user
118-
* config file is read. This is necessary since part of discoverPaths
118+
* config file is read. This is necessary since part of discoverPaths
119119
* depend on artist debug mode.
120120
*/
121121
FileManager::FileManager()
@@ -208,17 +208,17 @@ FileManager::FileManager()
208208
{
209209
Log::error("FileManager", "Could not file '%s'in any "
210210
"standard location (esp. ../data).", version.c_str());
211-
Log::error("FileManager",
211+
Log::error("FileManager",
212212
"Last location checked '%s'.", root_dir.c_str());
213-
Log::fatal("FileManager",
213+
Log::fatal("FileManager",
214214
"Set $SUPERTUXKART_DATADIR to point to the data directory.");
215215
// fatal will exit the application
216216
}
217-
217+
218218
addRootDirs(root_dir);
219-
219+
220220
std::string assets_dir;
221-
221+
222222
if (getenv("SUPERTUXKART_ASSETS_DIR") != NULL)
223223
{
224224
assets_dir = std::string(getenv("SUPERTUXKART_ASSETS_DIR"));
@@ -236,7 +236,7 @@ FileManager::FileManager()
236236
//is this needed?
237237
assets_dir = std::string(getenv("SUPERTUXKART_ROOT_PATH"));
238238
}
239-
239+
240240
if (!assets_dir.empty() && assets_dir != root_dir)
241241
{
242242
addRootDirs(assets_dir);
@@ -348,6 +348,8 @@ void FileManager::init()
348348
for(int i=0;i<(int)dirs.size(); i++)
349349
pushMusicSearchPath(dirs[i]);
350350
}
351+
m_cert_location = m_file_system->getAbsolutePath(
352+
getAsset("addons.supertuxkart.net.pem").c_str()).c_str();
351353
} // init
352354

353355
//-----------------------------------------------------------------------------
@@ -823,7 +825,7 @@ bool FileManager::checkAndCreateDirectoryP(const std::string &path)
823825
current_path += split[i] + "/";
824826
//Log::verbose("[FileManager]", "Checking for: '%s",
825827
// current_path.c_str());
826-
828+
827829
if (!checkAndCreateDirectory(current_path))
828830
{
829831
Log::error("[FileManager]", "Can't create dir '%s'",
@@ -935,12 +937,12 @@ void FileManager::checkAndCreateConfigDir()
935937
"falling back to '.'.", m_user_config_dir.c_str());
936938
m_user_config_dir = "./";
937939
}
938-
940+
939941
if (m_stdout_dir.empty())
940942
{
941943
m_stdout_dir = m_user_config_dir;
942944
}
943-
945+
944946
return;
945947
} // checkAndCreateConfigDir
946948

@@ -1186,7 +1188,7 @@ void FileManager::setStdoutName(const std::string& filename)
11861188
void FileManager::setStdoutDir(const std::string& dir)
11871189
{
11881190
m_stdout_dir = dir;
1189-
1191+
11901192
if (!m_stdout_dir.empty() && m_stdout_dir[m_stdout_dir.size() - 1] != '/')
11911193
{
11921194
m_stdout_dir += "/";
@@ -1390,8 +1392,8 @@ bool FileManager::removeDirectory(const std::string &name) const
13901392

13911393
for (std::string file : files)
13921394
{
1393-
if (file == "." || file == ".." || file == name + "/." ||
1394-
file == name + "/..")
1395+
if (file == "." || file == ".." || file == name + "/." ||
1396+
file == name + "/..")
13951397
continue;
13961398

13971399
if (UserConfigParams::logMisc())
@@ -1415,7 +1417,7 @@ bool FileManager::removeDirectory(const std::string &name) const
14151417
removeFile(file);
14161418
}
14171419
}
1418-
1420+
14191421
#if defined(WIN32)
14201422
return RemoveDirectory(name.c_str())==TRUE;
14211423
#else
@@ -1481,3 +1483,4 @@ bool FileManager::fileIsNewer(const std::string& f1, const std::string& f2) cons
14811483
stat(f2.c_str(), &stat2);
14821484
return stat1.st_mtime > stat2.st_mtime;
14831485
} // fileIsNewer
1486+

src/io/file_manager.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class FileManager : public NoCopy
8686

8787
/** Name of stdout file. */
8888
static std::string m_stdout_filename;
89-
89+
9090
/** Directory of stdout file. */
9191
static std::string m_stdout_dir;
9292

@@ -102,6 +102,8 @@ class FileManager : public NoCopy
102102
/** Directory where user-defined grand prix are stored. */
103103
std::string m_gp_dir;
104104

105+
std::string m_cert_location;
106+
105107
std::vector<TextureSearchPath> m_texture_search_path;
106108

107109
std::vector<std::string>
@@ -175,7 +177,7 @@ class FileManager : public NoCopy
175177
std::string getUserConfigFile(const std::string& fname) const;
176178
bool fileExists(const std::string& path) const;
177179
// ------------------------------------------------------------------------
178-
/** Convenience function to save some typing in the
180+
/** Convenience function to save some typing in the
179181
* file manager constructor. */
180182
bool fileExists(const char *prefix, const std::string& path) const
181183
{
@@ -214,7 +216,7 @@ class FileManager : public NoCopy
214216
m_music_search_path.push_back(path);
215217
} // pushMusicSearchPath
216218
// ------------------------------------------------------------------------
217-
/** Returns the full path to a shader (this function could be modified
219+
/** Returns the full path to a shader (this function could be modified
218220
* later to allow track-specific shaders).
219221
* \param name Name of the shader.
220222
*/
@@ -223,11 +225,12 @@ class FileManager : public NoCopy
223225
return getAsset(SHADER, name);
224226

225227
} // getShader
226-
228+
227229
std::string getShadersDir() const
228230
{
229231
return m_subdir_name[SHADER];
230232
}
233+
const std::string& getCertLocation() const { return m_cert_location; }
231234
}; // FileManager
232235

233236
extern FileManager* file_manager;

src/online/http_request.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ namespace Online
9595
m_parameters = "";
9696
m_curl_code = CURLE_OK;
9797
m_progress.setAtomic(0);
98-
if (m_http_header == nullptr)
98+
if (m_http_header == NULL)
9999
{
100-
std::string Host = "Host: " + StringUtils::getHostNameFromURL(UserConfigParams::m_server_multiplayer);
101-
m_http_header = curl_slist_append(m_http_header, Host.c_str());
100+
m_http_header = curl_slist_append(m_http_header,
101+
"Host: addons.supertuxkart.net");
102102
}
103103
m_disable_sending_log = false;
104104
} // init
@@ -182,8 +182,19 @@ namespace Online
182182
if (m_url.substr(0, 8) == "https://")
183183
{
184184
// https, load certificate info
185-
assert(m_http_header != nullptr);
186-
curl_easy_setopt(m_curl_session, CURLOPT_HTTPHEADER, m_http_header);
185+
assert(m_http_header != NULL);
186+
curl_easy_setopt(m_curl_session, CURLOPT_HTTPHEADER,
187+
m_http_header);
188+
const std::string& ci = file_manager->getCertLocation();
189+
CURLcode error = curl_easy_setopt(m_curl_session, CURLOPT_CAINFO,
190+
ci.c_str());
191+
if (error != CURLE_OK)
192+
{
193+
Log::error("HTTPRequest", "Error setting CAINFO to '%s'",
194+
ci.c_str());
195+
Log::error("HTTPRequest", "Error: '%s'.", error,
196+
curl_easy_strerror(error));
197+
}
187198
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYPEER, 1L);
188199
#ifdef __APPLE__
189200
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYHOST, 0L);

src/utils/string_utils.cpp

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -896,46 +896,18 @@ namespace StringUtils
896896
std::string removeWhitespaces(const std::string& input)
897897
{
898898
std::string out;
899-
899+
900900
for (char ch : input)
901901
{
902902
if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')
903903
continue;
904-
904+
905905
out += ch;
906906
}
907-
907+
908908
return out;
909909
}
910910

911-
// ------------------------------------------------------------------------
912-
std::string getHostNameFromURL(const std::string& url)
913-
{
914-
// Not even a valid URL
915-
if (url.length() < 8)
916-
return "";
917-
918-
// protocol is substr(0, first_color_position)
919-
const size_t first_colon_position = url.find_first_of(":");
920-
if (first_colon_position == std::string::npos)
921-
return "";
922-
923-
// skip ://
924-
const std::string url_without_protocol = url.substr(first_colon_position + 3);
925-
926-
// Find end with port
927-
const size_t port_colon_position = url_without_protocol.find_first_of(":");
928-
if (port_colon_position != std::string::npos)
929-
return url_without_protocol.substr(0, port_colon_position);
930-
931-
// Find end with path
932-
const size_t slash_position = url_without_protocol.find_first_of("/");
933-
if (slash_position != std::string::npos)
934-
return url_without_protocol.substr(0, slash_position);
935-
936-
return url_without_protocol;
937-
}
938-
939911
// ------------------------------------------------------------------------
940912
/** Breaks the text so that each line is smaller than max_width with the current settings.
941913
* The result is put into output, a vector of strings, with each line having its own string */

0 commit comments

Comments
 (0)