summaryrefslogtreecommitdiff
path: root/src/httpfetch.cpp
diff options
context:
space:
mode:
authorproller <proller@github.com>2014-01-07 02:50:45 +0400
committerproller <proller@github.com>2014-01-07 02:50:45 +0400
commitc62bab010fcf2b4b93af1cf0b71d4d0dbf78fed8 (patch)
treeebc099dab9ded4535351b3ef3115ca593c48d482 /src/httpfetch.cpp
parent3e728e722a788350718046daaf36f9a9c14ef1d1 (diff)
downloadminetest-c62bab010fcf2b4b93af1cf0b71d4d0dbf78fed8.tar.gz
minetest-c62bab010fcf2b4b93af1cf0b71d4d0dbf78fed8.tar.bz2
minetest-c62bab010fcf2b4b93af1cf0b71d4d0dbf78fed8.zip
Send long announce as POST, show OS in useragent
Add lag reporting to masterserver (average dtime) StyledWriter -> FastWriter in masterserver announce
Diffstat (limited to 'src/httpfetch.cpp')
-rw-r--r--src/httpfetch.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp
index 60e4591a9..9eed045fe 100644
--- a/src/httpfetch.cpp
+++ b/src/httpfetch.cpp
@@ -25,6 +25,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <list>
#include <map>
#include <errno.h>
+#ifndef _MSC_VER
+#include <sys/utsname.h>
+#endif
#include "jthread/jevent.h"
#include "config.h"
#include "exceptions.h"
@@ -32,10 +35,32 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include "util/container.h"
#include "util/thread.h"
+#include "version.h"
+#include "main.h"
+#include "settings.h"
JMutex g_httpfetch_mutex;
std::map<unsigned long, std::list<HTTPFetchResult> > g_httpfetch_results;
+ HTTPFetchRequest::HTTPFetchRequest()
+ {
+ url = "";
+ caller = HTTPFETCH_DISCARD;
+ request_id = 0;
+ timeout = g_settings->getS32("curl_timeout");
+ connect_timeout = timeout * 5;
+
+ useragent = std::string("Minetest ") + minetest_version_hash;
+#ifdef _MSC_VER
+ useragent += "Windows";
+#else
+ struct utsname osinfo;
+ uname(&osinfo);
+ useragent += std::string(" (") + osinfo.sysname + "; " + osinfo.release + "; " + osinfo.machine + ")";
+#endif
+ }
+
+
static void httpfetch_deliver_result(const HTTPFetchResult &fetchresult)
{
unsigned long caller = fetchresult.caller;