[Marble-commits] branches/KDE/4.3/kdeedu/marble/src/plugins/network/qnam
Jens-Michael Hoffmann
jensmh at gmx.de
Tue Aug 25 23:12:27 CEST 2009
SVN commit 1015558 by jmhoffmann:
Set user agent string to something more reasonable, also in preparation
for different use cases like "bulk download" or "viewing".
M +10 -1 QNamDownloadJob.cpp
M +2 -0 QNamDownloadJob.h
--- branches/KDE/4.3/kdeedu/marble/src/plugins/network/qnam/QNamDownloadJob.cpp #1015557:1015558
@@ -14,6 +14,8 @@
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkRequest>
+#include "global.h"
+
namespace Marble
{
@@ -30,7 +32,7 @@
void QNamDownloadJob::execute()
{
QNetworkRequest request( sourceUrl() );
- request.setRawHeader( "User-Agent", "Marble TinyWebBrowser" );
+ request.setRawHeader( "User-Agent", getUserAgent().toLatin1() );
m_networkReply = m_networkAccessManager->get( request );
connect( m_networkReply, SIGNAL( downloadProgress( qint64, qint64 )),
@@ -85,6 +87,13 @@
m_networkReply = 0;
}
+QString QNamDownloadJob::getUserAgent() const
+{
+ QString userAgent = QString( "Mozilla/5.0 (compatible; Marble/%1; Viewer; QNamNetworkPlugin)" )
+ .arg( MARBLE_VERSION_STRING );
+ return userAgent;
}
+}
+
#include "QNamDownloadJob.moc"
--- branches/KDE/4.3/kdeedu/marble/src/plugins/network/qnam/QNamDownloadJob.h #1015557:1015558
@@ -38,6 +38,8 @@
void finished();
private:
+ QString getUserAgent() const;
+
QNetworkAccessManager * m_networkAccessManager;
QNetworkReply * m_networkReply;
};
More information about the Marble-commits
mailing list