Don't force user agent if one is already set on the request

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-10-06 16:54:07 +02:00 committed by Kevin Ottens (Rebase PR Action)
parent d0ce8bc1ae
commit 50dd715f4d

View file

@ -76,7 +76,10 @@ QNetworkReply *AccessManager::createRequest(QNetworkAccessManager::Operation op,
setRawCookie(request.rawHeader("cookie"), request.url());
}
// Respect request specific user agent if any
if (!newRequest.hasRawHeader(QByteArrayLiteral("User-Agent"))) {
newRequest.setRawHeader(QByteArray("User-Agent"), Utility::userAgentString());
}
// Some firewalls reject requests that have a "User-Agent" but no "Accept" header
newRequest.setRawHeader(QByteArray("Accept"), "*/*");