#include "util/serialize.h"
#include "config.h"
#include "util/directiontables.h"
+#include "version.h"
#if USE_CURL
#include <curl/curl.h>
std::ostringstream stream;
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &stream);
+ curl_easy_setopt(curl, CURLOPT_USERAGENT, (std::string("Minetest ")+minetest_version_hash).c_str());
res = curl_easy_perform(curl);
if (res == CURLE_OK) {
std::string data = stream.str();
#include "log.h"
#include "main.h" // for g_settings
#include "settings.h"
+#include "version.h"
#if USE_CURL
#include <curl/curl.h>
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &liststring);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, g_settings->getS32("curl_timeout"));
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, g_settings->getS32("curl_timeout"));
+ curl_easy_setopt(curl, CURLOPT_USERAGENT, (std::string("Minetest ")+minetest_version_hash).c_str());
if (chunk != 0)
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, targetfile);
-
+ curl_easy_setopt(curl, CURLOPT_USERAGENT, (std::string("Minetest ")+minetest_version_hash).c_str());
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
errorstream << "File at url \"" << url
CURLcode res;
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_URL, (g_settings->get("serverlist_url")+std::string("/announce?json=")+curl_easy_escape(curl, writer.write( server ).c_str(), 0)).c_str());
- //curl_easy_setopt(curl, CURLOPT_USERAGENT, "minetest");
+ curl_easy_setopt(curl, CURLOPT_USERAGENT, (std::string("Minetest ")+minetest_version_hash).c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, ServerList::ServerAnnounceCallback);
//curl_easy_setopt(curl, CURLOPT_WRITEDATA, &liststring);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1);
if(m_addr_family == AF_INET6)
{
struct sockaddr_in6 address;
+ memset(&address, 0, sizeof(address));
+
address.sin6_family = AF_INET6;
address.sin6_addr = in6addr_any;
address.sin6_port = htons(port);
else
{
struct sockaddr_in address;
+ memset(&address, 0, sizeof(address));
+
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(port);
if(m_addr_family == AF_INET6)
{
struct sockaddr_in6 address;
+ memset(&address, 0, sizeof(address));
socklen_t address_len = sizeof(address);
received = recvfrom(m_handle, (char *) data,
else
{
struct sockaddr_in address;
+ memset(&address, 0, sizeof(address));
+
socklen_t address_len = sizeof(address);
received = recvfrom(m_handle, (char *) data,
// There is data
return true;
}
-
-