parent
6f44492238
commit
8903c68460
|
@ -48,6 +48,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "util/serialize.h"
|
||||
#include "config.h"
|
||||
#include "util/directiontables.h"
|
||||
#include "version.h"
|
||||
|
||||
#if USE_CURL
|
||||
#include <curl/curl.h>
|
||||
|
@ -245,6 +246,7 @@ void * MediaFetchThread::Thread()
|
|||
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();
|
||||
|
|
|
@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "log.h"
|
||||
#include "main.h" // for g_settings
|
||||
#include "settings.h"
|
||||
#include "version.h"
|
||||
|
||||
#if USE_CURL
|
||||
#include <curl/curl.h>
|
||||
|
@ -56,6 +57,7 @@ Json::Value fetchJsonValue(const std::string url,
|
|||
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);
|
||||
|
|
|
@ -532,7 +532,7 @@ bool GUIEngine::downloadFile(std::string url,std::string target) {
|
|||
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
|
||||
|
|
|
@ -241,7 +241,7 @@ void sendAnnounce(std::string action, const std::vector<std::string> & clients_n
|
|||
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);
|
||||
|
|
|
@ -345,6 +345,8 @@ void UDPSocket::Bind(u16 port)
|
|||
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);
|
||||
|
@ -360,6 +362,8 @@ void UDPSocket::Bind(u16 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);
|
||||
|
@ -454,6 +458,7 @@ int UDPSocket::Receive(Address & sender, void * data, int size)
|
|||
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,
|
||||
|
@ -470,6 +475,8 @@ int UDPSocket::Receive(Address & sender, void * data, int size)
|
|||
else
|
||||
{
|
||||
struct sockaddr_in address;
|
||||
memset(&address, 0, sizeof(address));
|
||||
|
||||
socklen_t address_len = sizeof(address);
|
||||
|
||||
received = recvfrom(m_handle, (char *) data,
|
||||
|
@ -568,5 +575,3 @@ bool UDPSocket::WaitData(int timeout_ms)
|
|||
// There is data
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue