Bug 217521

Summary: Blocked Hosts in IFrame Redirect to Error Page
Product: [Unmaintained] rekonq Reporter: markuss <kamikazow>
Component: generalAssignee: Andrea Diamantini <adjam7>
Status: RESOLVED FIXED    
Severity: normal CC: apaku, teg
Priority: NOR    
Version: 0.4.90   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description markuss 2009-12-06 01:22:56 UTC
Version:           0.3 (using KDE 4.3.4)
OS:                Linux

I've blocked ad providers via a custom hosts file.
Instead of simply not displaying those IFrames, Rekonq redirects the whole page to the "Connection refused" page.

How to reproduce:
1. Quit Rekonq.
2. Add "0.0.0.0 adserver.adtechus.com" to /etc/hosts
3. Relaunch Rekonq and try to open www.osnews.com
Comment 1 Andrea Diamantini 2010-01-25 00:36:51 UTC
We now have an adblock feature in the upcoming rekonq 0.4.
:)
Comment 2 markuss 2010-01-25 03:45:13 UTC
Does this actually fix the redirecting bug or just work around it?
IFrames that are no ads could be loaded from another server. If Rekonq still redirects the whole page to an error message, usability is hurt despite an ad blocker.
Comment 3 Andrea Diamantini 2010-01-25 10:08:35 UTC
On Monday 25 January 2010 03:45:15 Markus S. wrote:
> https://bugs.kde.org/show_bug.cgi?id=217521
> 
> 
> 
> 
> 
> --- Comment #2 from Markus S. <kamikazow web de>  2010-01-25 03:45:13 ---
> Does this actually fix the redirecting bug or just work around it?
> IFrames that are no ads could be loaded from another server. If Rekonq
> still redirects the whole page to an error message, usability is hurt
> despite an ad blocker.

It should work as expected.
If not, please let me know about.

Regards,
Comment 4 markuss 2010-02-13 06:02:03 UTC
Tested with 0.4 beta1. Redirect bug still exists.
This is definitely a rekonq bug and not a QtWebKit bug. I checked with Arora and Arora is free of it.
Comment 5 Andrea Diamantini 2010-02-22 02:03:14 UTC
(Finally) Fixed in rekonq 0.3.95 :)
Comment 6 markuss 2010-05-30 15:53:57 UTC

*** This bug has been marked as a duplicate of bug 203097 ***
Comment 7 markuss 2010-05-30 18:44:43 UTC
*** Bug 237617 has been marked as a duplicate of this bug. ***
Comment 8 markuss 2010-05-30 18:47:34 UTC
*** Bug 240084 has been marked as a duplicate of this bug. ***
Comment 9 Andrea Diamantini 2010-06-02 03:00:48 UTC
This definitely works for me in 0.4.91.
Can someone point me to an url where this problem happens? I really cannot reproduce this..
Comment 10 Andreas Pakulat 2010-06-05 01:35:40 UTC
It doesn't work with master here, I've setup a test page that demonstrates the problem: http://apaku.de/vardata/index.html

If you can't reproduce, I'm open to suggestions how to further debug it.
Comment 11 Andrea Diamantini 2010-06-06 18:30:32 UTC
commit d9b2a7f2468dd675d492db32e4d683c2a3dcd842
Author: Andrea Diamantini <adjam7@gmail.com>
Date:   Sun Jun 6 18:31:27 2010 +0200

    Stupid me! Showing error page in mainFrame() instead of the frame originating
    the error request...
    
    This should fix bug 217521
    
    CCBUG: 217521

diff --git a/src/webpage.cpp b/src/webpage.cpp
index c859b5c..32b785b 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -521,7 +521,7 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
         break;
 
     case QNetworkReply::UnknownNetworkError:                 // unknown network-related error detected
-        _protHandler.postHandling(reply->request(), mainFrame());
+        _protHandler.postHandling(reply->request(), frame);
         return;
 
     case QNetworkReply::ConnectionRefusedError:              // remote server refused connection
@@ -536,10 +536,13 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
         kDebug() << "ERROR " << reply->error() << ": " << reply->errorString();
         if (reply->url() == _loadingUrl)
         {
-            mainFrame()->setHtml(errorPage(reply));
+            frame->setHtml(errorPage(reply));
+            if(isMainFrameRequest)
+            {
             _isOnRekonqPage = true;
             Application::instance()->mainWindow()->mainView()->urlBar()->setQUrl(_loadingUrl);
             Application::instance()->mainWindow()->updateActions();
+            }
         }
         break;
Comment 12 Andreas Pakulat 2010-06-06 18:52:51 UTC
Yeap that works, thanks a lot. I'll close this bug.