diff options
author | saturneric <[email protected]> | 2024-02-26 12:38:30 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-02-26 12:38:30 +0000 |
commit | 59cdf57e8f807a0fe2505837e2eed5871ea281c8 (patch) | |
tree | 420cc23dc12ca947e39906981c8814e04b51e0c4 /src/ui/thread/ProxyConnectionTestTask.cpp | |
parent | fix: add English translation (diff) | |
download | GpgFrontend-59cdf57e8f807a0fe2505837e2eed5871ea281c8.tar.gz GpgFrontend-59cdf57e8f807a0fe2505837e2eed5871ea281c8.zip |
feat: add user agent header when doing http request
Diffstat (limited to '')
-rw-r--r-- | src/ui/thread/ProxyConnectionTestTask.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ui/thread/ProxyConnectionTestTask.cpp b/src/ui/thread/ProxyConnectionTestTask.cpp index b681ca6d..003205e5 100644 --- a/src/ui/thread/ProxyConnectionTestTask.cpp +++ b/src/ui/thread/ProxyConnectionTestTask.cpp @@ -30,6 +30,8 @@ #include <QtNetwork> +#include "GpgFrontendBuildInfo.h" + GpgFrontend::UI::ProxyConnectionTestTask::ProxyConnectionTestTask(QString url, int timeout) : Task("proxy_connection_test_task"), @@ -40,7 +42,10 @@ GpgFrontend::UI::ProxyConnectionTestTask::ProxyConnectionTestTask(QString url, } auto GpgFrontend::UI::ProxyConnectionTestTask::Run() -> int { - auto* network_reply = network_manager_->get(QNetworkRequest{url_}); + auto request = QNetworkRequest(url_); + request.setHeader(QNetworkRequest::UserAgentHeader, HTTP_REQUEST_USER_AGENT); + + auto* network_reply = network_manager_->get(request); auto* timer = new QTimer(this); connect(network_reply, &QNetworkReply::finished, this, |