1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 01:43:12 +02:00

Set User-Agent in url_curl as well (already done in url_unreal).

This commit is contained in:
Bram Matthys
2021-08-28 20:37:09 +02:00
parent 8b64f44400
commit c28239dd68
+3
View File
@@ -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);