summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Iacovitti <aiacovitti@libero.it>2012-04-10 21:25:11 (GMT)
committerAndrea Iacovitti <aiacovitti@libero.it>2012-04-10 21:25:11 (GMT)
commit532d7c16c1f02de2cee028cd9bce7b7614c2737d (patch)
tree259c95272201cab39b874f3dba815300e345d682
parent5997971b8951ab7bd54932091b266d096b08b8dc (diff)
Do not cache error pages. Likely they not contain adblock filter rules.
FIXED-IN: 4.8.3
-rw-r--r--khtml/khtml_settings.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/khtml/khtml_settings.cpp b/khtml/khtml_settings.cpp
index bc79519..118f388 100644
--- a/khtml/khtml_settings.cpp
+++ b/khtml/khtml_settings.cpp
@@ -170,14 +170,18 @@ public slots:
KIO::StoredTransferJob *tJob = qobject_cast<KIO::StoredTransferJob*>(job);
Q_ASSERT(tJob);
- if ( job->error() == KJob::NoError )
- {
+ if ( tJob->error() ) {
+ kDebug(6000) << "Failed to download" << tJob->url() << "with message:" << tJob->errorText();
+ }
+ else if ( tJob->isErrorPage() ) { // 4XX error code
+ kDebug(6000) << "Failed to fetch filter list" << tJob->url();
+ }
+ else {
const QByteArray byteArray = tJob->data();
const QString localFileName = tJob->property( "khtmlsettings_adBlock_filename" ).toString();
QFile file(localFileName);
- if ( file.open(QFile::WriteOnly) )
- {
+ if ( file.open(QFile::WriteOnly) ) {
bool success = file.write(byteArray) == byteArray.size();
file.close();
if ( success )
@@ -188,9 +192,8 @@ public slots:
else
kDebug(6000) << "Cannot open file" << localFileName << "for filter list";
}
- else
- kDebug(6000) << "Downloading" << tJob->url() << "failed with message:" << job->errorText();
- }
+
+ }
};