From c28239dd68ca97fe9ec7b18f97828982e91fb725 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 28 Aug 2021 20:37:09 +0200 Subject: [PATCH] Set User-Agent in url_curl as well (already done in url_unreal). --- src/url_curl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/url_curl.c b/src/url_curl.c index 8a29c16ec..0141e8bd1 100644 --- a/src/url_curl.c +++ b/src/url_curl.c @@ -239,6 +239,7 @@ void url_init(void) void download_file_async(const char *url, time_t cachetime, vFP callback, void *callback_data, char *original_url, int maxredirects) { static char errorbuf[CURL_ERROR_SIZE]; + char user_agent[256]; CURL *curl; char *file; char *filename; @@ -277,6 +278,8 @@ void download_file_async(const char *url, time_t cachetime, vFP callback, void * safe_free(file); curl_easy_setopt(curl, CURLOPT_URL, url); + snprintf(user_agent, sizeof(user_agent), "UnrealIRCd %s", VERSIONONLY); + curl_easy_setopt(curl, CURLOPT_USERAGENT, user_agent); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, do_download); curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)handle->file_fd); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);