@@ -68,9 +68,6 @@ namespace Reporting
68
68
69
69
// Internal limiter on number of requests per instance.
70
70
static u32 spamProtectionCount = 0 ;
71
- // Temporarily stores a reference to the hostname.
72
- static std::string lastHostname;
73
-
74
71
// Keeps track of whether a harmful setting was ever used.
75
72
static bool everUnsupported = false ;
76
73
// Support is cached here to avoid checking it on every single request.
@@ -231,7 +228,7 @@ namespace Reporting
231
228
// Returns the full host (e.g. report.ppsspp.org:80.)
232
229
std::string ServerHost () {
233
230
if (g_Config.sReportHost .compare (" default" ) == 0 )
234
- return " " ;
231
+ return " report.ppsspp.org " ;
235
232
return g_Config.sReportHost ;
236
233
}
237
234
@@ -255,8 +252,7 @@ namespace Reporting
255
252
}
256
253
257
254
// Returns only the hostname part (e.g. "report.ppsspp.org".)
258
- static const char *ServerHostname ()
259
- {
255
+ static std::string ServerHostname () {
260
256
if (!IsEnabled ())
261
257
return NULL ;
262
258
@@ -265,10 +261,9 @@ namespace Reporting
265
261
266
262
// This means there's no port number - it's already the hostname.
267
263
if (length == host.npos )
268
- lastHostname = host;
264
+ return host;
269
265
else
270
- lastHostname = host.substr (0 , length);
271
- return lastHostname.c_str ();
266
+ return host.substr (0 , length);
272
267
}
273
268
274
269
// Returns only the port part (e.g. 80) as an int.
@@ -296,9 +291,9 @@ namespace Reporting
296
291
297
292
static void SendReportRequest (const char *uri, const std::string &data, const std::string &mimeType, std::function<void (http::Request &)> callback) {
298
293
char url[1024 ];
299
- const char * hostname = ServerHostname ();
294
+ std::string hostname = ServerHostname ();
300
295
int port = ServerPort ();
301
- snprintf (url, sizeof (url), " http://%s:%d%s" , hostname, port, uri);
296
+ snprintf (url, sizeof (url), " http://%s:%d%s" , hostname. c_str () , port, uri);
302
297
g_DownloadManager.AsyncPostWithCallback (url, data, mimeType, http::ProgressBarMode::NONE, callback);
303
298
}
304
299
0 commit comments