Skip to content

Commit

Permalink
Use built-in method for setting header
Browse files Browse the repository at this point in the history
PR #21961.
  • Loading branch information
Chocobo1 authored Dec 8, 2024
1 parent 3fcc298 commit cbf7c09
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/base/net/downloadmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,11 @@ void Net::DownloadManager::processRequest(DownloadHandlerImpl *downloadHandler)

const DownloadRequest downloadRequest = downloadHandler->downloadRequest();
QNetworkRequest request {downloadRequest.url()};

if (downloadRequest.userAgent().isEmpty())
request.setRawHeader("User-Agent", getBrowserUserAgent());
else
request.setRawHeader("User-Agent", downloadRequest.userAgent().toUtf8());
request.setHeader(QNetworkRequest::UserAgentHeader, (downloadRequest.userAgent().isEmpty()
? getBrowserUserAgent() : downloadRequest.userAgent().toUtf8()));

// Spoof HTTP Referer to allow adding torrent link from Torcache/KickAssTorrents
request.setRawHeader("Referer", request.url().toEncoded().data());
request.setRawHeader("Referer", request.url().toEncoded());
#ifdef QT_NO_COMPRESS
// The macro "QT_NO_COMPRESS" defined in QT will disable the zlib related features
// and reply data auto-decompression in QT will also be disabled. But we can support
Expand Down

0 comments on commit cbf7c09

Please sign in to comment.