mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-31 09:44:50 +01:00
Only set user agent if it's missing in NetworkAccessManager
This commit is contained in:
parent
c146290e07
commit
38cf3dc141
@ -115,11 +115,12 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent)
|
||||
|
||||
QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData) {
|
||||
|
||||
QByteArray user_agent = QString("%1 %2").arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion()).toUtf8();
|
||||
|
||||
QByteArray user_agent;
|
||||
if (request.hasRawHeader("User-Agent")) {
|
||||
// Append the existing user-agent set by a client library.
|
||||
user_agent += " " + request.rawHeader("User-Agent");
|
||||
user_agent = request.rawHeader("User-Agent");
|
||||
}
|
||||
else {
|
||||
user_agent = QString("%1 %2").arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion()).toUtf8();
|
||||
}
|
||||
|
||||
QNetworkRequest new_request(request);
|
||||
|
Loading…
x
Reference in New Issue
Block a user