mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 04:24:23 +00:00
BUGFIX: Consider HTTP downloads >1MB as invalid .torrent files and abort them
This commit is contained in:
parent
7b38ea4151
commit
1ea7340111
@ -15,6 +15,7 @@
|
||||
- FEATURE: Support for multiple scan folders (Patch by Christian Kandeler)
|
||||
- BUGFIX: Only one log window can be opened at a time
|
||||
- BUGFIX: Optimized RSS module memory usage
|
||||
- BUGFIX: Consider HTTP downloads >1MB as invalid .torrent files and abort
|
||||
- COSMETIC: Improved style management
|
||||
|
||||
* Mon Jan 18 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
|
||||
|
@ -2163,7 +2163,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
);
|
||||
//emit aboutToDownloadFromUrl(url);
|
||||
// Launch downloader thread
|
||||
downloader->downloadUrl(url);
|
||||
downloader->downloadTorrentUrl(url);
|
||||
}
|
||||
|
||||
void Bittorrent::downloadFromURLList(const QStringList& urls) {
|
||||
|
@ -95,7 +95,12 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
void downloadThread::downloadUrl(QString url){
|
||||
void downloadThread::downloadTorrentUrl(QString url){
|
||||
QNetworkReply *reply = downloadUrl(url);
|
||||
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64)));
|
||||
}
|
||||
|
||||
QNetworkReply* downloadThread::downloadUrl(QString url){
|
||||
// Update proxy settings
|
||||
applyProxySettings();
|
||||
// Process download request
|
||||
@ -105,7 +110,26 @@ void downloadThread::downloadUrl(QString url){
|
||||
// Web server banning
|
||||
request.setRawHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5");
|
||||
qDebug("Downloading %s...", qPrintable(request.url().toString()));
|
||||
networkManager->get(request);
|
||||
return networkManager->get(request);
|
||||
}
|
||||
|
||||
void downloadThread::checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal) {
|
||||
if(bytesTotal > 0) {
|
||||
QNetworkReply *reply = static_cast<QNetworkReply*>(sender());
|
||||
// Total number of bytes is available
|
||||
if(bytesTotal > 1048576) {
|
||||
// More than 1MB, this is probably not a torrent file, aborting...
|
||||
reply->abort();
|
||||
} else {
|
||||
disconnect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64)));
|
||||
}
|
||||
} else {
|
||||
if(bytesReceived > 1048576) {
|
||||
// More than 1MB, this is probably not a torrent file, aborting...
|
||||
QNetworkReply *reply = static_cast<QNetworkReply*>(sender());
|
||||
reply->abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void downloadThread::applyProxySettings() {
|
||||
|
@ -51,7 +51,8 @@ signals:
|
||||
public:
|
||||
downloadThread(QObject* parent);
|
||||
~downloadThread();
|
||||
void downloadUrl(QString url);
|
||||
QNetworkReply* downloadUrl(QString url);
|
||||
void downloadTorrentUrl(QString url);
|
||||
//void setProxy(QString IP, int port, QString username, QString password);
|
||||
|
||||
protected:
|
||||
@ -60,6 +61,7 @@ protected:
|
||||
|
||||
protected slots:
|
||||
void processDlFinished(QNetworkReply* reply);
|
||||
void checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal);
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user