diff --git a/src/netcode/client_connection.c b/src/netcode/client_connection.c index 178ceff632822e0455084b8e63e458bef32fbf38..36ed718265b3cfa42acc3ef238c436882bb918a1 100644 --- a/src/netcode/client_connection.c +++ b/src/netcode/client_connection.c @@ -634,7 +634,7 @@ static const char *GetPrintableFileSize(UINT64 filesize) if (filesize >= 1024*1024) snprintf(downloadsize, sizeof(downloadsize), "%.2fMiB", (double)filesize / (1024*1024)); else if (filesize < 1024) - snprintf(downloadsize, sizeof(downloadsize), "%luB", filesize); + snprintf(downloadsize, sizeof(downloadsize), "%sB", sizeu1(filesize)); else snprintf(downloadsize, sizeof(downloadsize), "%.2fKiB", (double)filesize / 1024); diff --git a/src/netcode/d_netfil.c b/src/netcode/d_netfil.c index 135e5ed705ec33823d51766aa589000f57e03a3b..03ad8303e6571a477b9f107154d9ed3102ac58a9 100644 --- a/src/netcode/d_netfil.c +++ b/src/netcode/d_netfil.c @@ -10,6 +10,10 @@ /// \file d_netfil.c /// \brief Transfer a file using HSendPacket. +#ifdef HAVE_CURL +#include <curl/curl.h> +#endif + #include <stdio.h> #include <sys/stat.h> @@ -53,10 +57,6 @@ #include <errno.h> -#ifdef HAVE_CURL -#include <curl/curl.h> -#endif - // Prototypes static boolean AddFileToSendQueue(INT32 node, UINT8 fileid); @@ -1633,7 +1633,11 @@ boolean CURLPrepareFile(const char* url, int dfilenum) curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s?md5=%s", url, curl_realname, md5tmp)); // Only allow HTTP and HTTPS +#if (LIBCURL_VERSION_MAJOR <= 7) && (LIBCURL_VERSION_MINOR < 85) + curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); +#else curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https"); +#endif // Set user agent, as some servers won't accept invalid user agents. curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("Sonic Robo Blast 2/v%d.%d", VERSION, SUBVERSION));