From 63d34ac348e5cbdf70bfcca206264b7da00dac7e Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Tue, 6 Mar 2018 15:58:15 +0100 Subject: [PATCH] Add User-Agent header and set request timeout to avoid infinite download hangs Resolves #1573, resolves #1645 --- src/gui/EditWidgetIcons.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/EditWidgetIcons.cpp b/src/gui/EditWidgetIcons.cpp index 1c33150b5..af4476ac3 100644 --- a/src/gui/EditWidgetIcons.cpp +++ b/src/gui/EditWidgetIcons.cpp @@ -197,12 +197,12 @@ QImage EditWidgetIcons::fetchFavicon(const QUrl& url) curl_easy_setopt(curl, CURLOPT_URL, baUrl.data()); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 5L); curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 5L); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10L); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &imagedata); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &writeCurlResponse); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L); #ifdef Q_OS_WIN const QDir appDir = QFileInfo(QCoreApplication::applicationFilePath()).absoluteDir(); if (appDir.exists("ssl\\certs")) {