mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-15 10:33:59 +02:00
Allow setting User-Agent via nativeAsyncRequest
This commit is contained in:
@@ -951,6 +951,8 @@ JSResolverHelper::nativeAsyncRequestDone( int requestId, NetworkReply* reply )
|
||||
map["status"] = reply->reply()->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt();
|
||||
map["statusText"] = QString("%1 %2").arg( map["status"].toString() )
|
||||
.arg( reply->reply()->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString() );
|
||||
if (reply->reply()->hasRawHeader( "Content-Type" ))
|
||||
map["contentType"] = reply->reply()->rawHeader( "Content-Type" );
|
||||
|
||||
bool ok = false;
|
||||
QString json = QString::fromUtf8( TomahawkUtils::toJson( map, &ok ) );
|
||||
|
@@ -148,6 +148,12 @@ NetworkReply::load( const QUrl& url )
|
||||
m_formerUrls << url.toString();
|
||||
QNetworkRequest request( url );
|
||||
|
||||
//Carryover User-Agent
|
||||
if ( m_reply->request().hasRawHeader( "User-Agent" ))
|
||||
{
|
||||
request.setRawHeader( "User-Agent", m_reply->request().rawHeader( "User-Agent" ) );
|
||||
}
|
||||
|
||||
Q_ASSERT( Tomahawk::Utils::nam() != 0 );
|
||||
|
||||
QNetworkAccessManager::Operation op = m_reply->operation();
|
||||
|
Reference in New Issue
Block a user