1
0
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:
Jonas Kvinge 2019-09-22 17:05:26 +02:00
parent c146290e07
commit 38cf3dc141

View File

@ -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);