Bug 60479 - Browser Referer Bug ??
Summary: Browser Referer Bug ??
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Mandrake RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
: 60297 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-06-29 02:25 UTC by vsw
Modified: 2007-09-25 13:21 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vsw 2003-06-29 02:25:17 UTC
Version:           4.0 (using KDE 3.1.0)
Installed from:    Mandrake Linux Cooker i586 - Cooker
Compiler:          gcc version 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)
OS:          Linux (i686) release 2.4.21-0.18mdk

Hey guys!! Admin here at http://www.redclouds.com (Adult content, be forewarned).
We have a few reports of Konq 3.1.x users unable to access our secure sites & i've confirmed on my version here.

Seems to authenticate fine, redirects & appears to send referer in logs:

;auth.redclouds.com;301;"http://auth.redclouds.com/";"GET /members4 HTTP/1.1";[28/Jun/2003:20:08:37 -0400];"Mozilla/5.0 (compatible; Konqueror/3.1)"
;auth.redclouds.com;200;"http://auth.redclouds.com/";"GET /members4/ HTTP/1.1";[28/Jun/2003:20:08:37 -0400];"Mozilla/5.0 (compatible; Konqueror/3.1)"

However once I get to our Entry Portals (where we require http_referer) blam, cannot access as if the browser is not sending the referer.

If interested we can setup an account to help resolve :) We're an opensource shop, so we like to make sure K users are accessing fine!!

Regards

VSW
Comment 1 Thiago Macieira 2003-06-29 02:35:32 UTC
*** Bug 60297 has been marked as a duplicate of this bug. ***
Comment 2 Thiago Macieira 2003-06-29 02:40:19 UTC
Hello, 
 
bug #60297 was the original report that led us to the problem in the site. 
 
I have tested Konqueror and it seems to be sending the Referrer: line in the 
HTTP/1.1 header request to the server. And from your message, it seems you're 
saying Konqueror is sending the Referrer line, but the site still doesn't work. 
 
Can you post the relevant lines from your HTTP server showing the requests 
Konqueror makes and the requests another browser makes (i.e., a situation that 
works and one that doesn't)? 
Comment 3 George Staikos 2003-07-03 18:09:34 UTC
Bug is mostly fixed (not yet committed to CVS) but one remaining problem lurks and 
it's proving difficult to fix. 
Comment 4 George Staikos 2003-07-03 19:05:05 UTC
Subject: kdelibs/khtml

CVS commit by staikos: 

Clear out the username and password when setting the referrer.
This affects Safari as well.

Fixes most of 60479, but not all.

CCMAIL: 60479@bugs.kde.org, khtml-devel@kde.org


  M +2 -0      khtml_part.cpp   1.867


--- kdelibs/khtml/khtml_part.cpp  #1.866:1.867
@@ -1490,4 +1490,6 @@ void KHTMLPart::begin( const KURL &url, 
   KURL ref(url);
   ref.setRef(QString::null);
+  ref.setUser(QString::null);
+  ref.setPass(QString::null);
   d->m_referrer = ref.protocol().startsWith("http") ? ref.url() : "";
 


Comment 5 George Staikos 2003-07-03 22:21:02 UTC
Subject: kdebase/konqueror

CVS commit by staikos: 


pass the referrer for "Open in New Tab" and "Open in Background Tab"

Tests seem to indicate that these are the only cases that behave as such with
this patch (typing urls, bookmarks don't send the referrer)

Fixes all but one small remaining part of #60479

CCMAIL: 60479@bugs.kde.org


  M +19 -1     konq_mainwindow.cc   1.1195
  M +1 -1      konq_mainwindow.h   1.404


--- kdebase/konqueror/konq_mainwindow.cc  #1.1194:1.1195
@@ -435,5 +435,5 @@ void KonqMainWindow::openFilteredURL( co
 
 void KonqMainWindow::openURL( KonqView *_view, const KURL &_url,
-                              const QString &_serviceType, const KonqOpenURLRequest & req,
+                              const QString &_serviceType, KonqOpenURLRequest req,
                               bool trustedSource )
 {
@@ -548,4 +548,12 @@ void KonqMainWindow::openURL( KonqView *
   {
       kdDebug(1202) << "Creating new konqrun for " << url.url() << " req.typedURL=" << req.typedURL << endl;
+      if (currentURL().startsWith("http")) {
+          KURL tmp = currentURL();
+          tmp.setRef(QString::null);
+          tmp.setUser(QString::null);
+          tmp.setPass(QString::null);
+          req.args.metaData()["referrer"] = tmp.url();
+      }
+
       KonqRun * run = new KonqRun( this, view /* can be 0L */, url, req, trustedSource );
       if ( view )
@@ -588,4 +596,12 @@ bool KonqMainWindow::openView( QString s
   bool bOthersFollowed = false;
 
+  if (currentURL().startsWith("http")) {
+      KURL tmp = currentURL();
+      tmp.setRef(QString::null);
+      tmp.setUser(QString::null);
+      tmp.setPass(QString::null);
+      req.args.metaData()["referrer"] = tmp.url();
+  }
+
   if ( childView )
   {
@@ -777,4 +793,6 @@ bool KonqMainWindow::openView( QString s
       //kdDebug(1202) << "req.nameFilter= " << req.nameFilter << endl;
       //kdDebug(1202) << "req.typedURL= " << req.typedURL << endl;
+      //kdDebug(1202) << "Browser extension? " << (childView->browserExtension() ? "YES" : "NO") << endl;
+      //kdDebug(1202) << "Referrer: " << req.args.metaData()["referrer"] << endl;
       childView->setTypedURL( req.typedURL );
       if ( childView->browserExtension() )

--- kdebase/konqueror/konq_mainwindow.h  #1.403:1.404
@@ -110,5 +110,5 @@ public:
   void openURL( KonqView * view, const KURL & url,
                 const QString &serviceType = QString::null,
-                const KonqOpenURLRequest & req = KonqOpenURLRequest(), bool trustedSource = false );
+                KonqOpenURLRequest req = KonqOpenURLRequest(), bool trustedSource = false );
 
   /**


Comment 6 George Staikos 2003-07-03 22:35:46 UTC
Subject: KDE_3_1_BRANCH: kdebase/konqueror

CVS commit by staikos: 


backport Open in (New|Background) Tab referrer changes from HEAD

CCMAIL: 60479@bugs.kde.org


  M +9 -1      konq_mainwindow.cc   1.1083.2.29
  M +1 -1      konq_mainwindow.h   1.374.2.5


--- kdebase/konqueror/konq_mainwindow.cc  #1.1083.2.28:1.1083.2.29
@@ -394,5 +394,5 @@ void KonqMainWindow::openFilteredURL( co
 
 void KonqMainWindow::openURL( KonqView *_view, const KURL &_url,
-                              const QString &_serviceType, const KonqOpenURLRequest & req,
+                              const QString &_serviceType, KonqOpenURLRequest req,
                               bool trustedSource )
 {
@@ -504,4 +504,12 @@ void KonqMainWindow::openURL( KonqView *
   {
       kdDebug(1202) << "Creating new konqrun for " << url.url() << " req.typedURL=" << req.typedURL << endl;
+      if (currentURL().startsWith("http")) {
+          KURL tmp = currentURL();
+          tmp.setRef(QString::null);
+          tmp.setUser(QString::null);
+          tmp.setPass(QString::null);
+          req.args.metaData()["referrer"] = tmp.url();
+      }
+
       KonqRun * run = new KonqRun( this, view /* can be 0L */, url, req, trustedSource );
       if ( view )

--- kdebase/konqueror/konq_mainwindow.h  #1.374.2.4:1.374.2.5
@@ -103,5 +103,5 @@ public:
   void openURL( KonqView * view, const KURL & url,
                 const QString &serviceType = QString::null,
-                const KonqOpenURLRequest & req = KonqOpenURLRequest(), bool trustedSource = false );
+                KonqOpenURLRequest req = KonqOpenURLRequest(), bool trustedSource = false );
 
   /**


Comment 7 George Staikos 2003-07-04 06:30:52 UTC
Subject: kdebase/konqueror

CVS commit by staikos: 

provide our own window_new action with referrer goodness built in for those
special http(s)? occasions.

CCMAIL: 60479-done@bugs.kde.org


  M +5 -0      konq_guiclients.cc   1.59
  M +24 -0     konq_mainwindow.cc   1.1196
  M +1 -0      konq_mainwindow.h   1.405


--- kdebase/konqueror/konq_guiclients.cc  #1.58:1.59
@@ -102,4 +102,9 @@ PopupMenuGUIClient::PopupMenuGUIClient( 
   }
 
+  QDomElement openInWindow = m_doc.createElement( "action" );
+  openInWindow.setAttribute( "name", "newview" );
+  openInWindow.setAttribute( "group", "tabhandling" );
+  menu.appendChild( openInWindow );
+
   QDomElement openInTabElement = m_doc.createElement( "action" );
   openInTabElement.setAttribute( "name", "openintab" );

--- kdebase/konqueror/konq_mainwindow.cc  #1.1195:1.1196
@@ -2246,4 +2246,24 @@ void KonqMainWindow::slotBreakOffTabPopu
 }
 
+void KonqMainWindow::slotPopupNewWindow()
+{
+    kdDebug(1202) << "KonqMainWindow::popupNewWindow()" << endl;
+
+    KParts::URLArgs args;
+    if (currentURL().startsWith("http")) {
+        KURL tmp = currentURL();
+        tmp.setRef(QString::null);
+        tmp.setUser(QString::null);
+        tmp.setPass(QString::null);
+        args.metaData()["referrer"] = tmp.url();
+    }
+
+    KFileItemListIterator it ( popupItems );
+    for ( ; it.current(); ++it )
+    {
+        KonqMisc::createNewWindow( (*it)->url(), args );
+    }
+}
+
 void KonqMainWindow::slotPopupNewTabAtFront()
 {
@@ -3789,4 +3809,7 @@ void KonqMainWindow::slotPopupMenu( KXML
   popupMenuCollection.insert( actPaste );
 
+  KAction *actNewWindow = new KAction( i18n( "Open in New &Window" ), "window_new", 0, this, SLOT( slotPopupNewWindow() ), actionCollection(), "newview" );
+  actNewWindow->setStatusText( i18n( "Open the document in a new window" ) );
+  popupMenuCollection.insert( actNewWindow );
   KAction *actNewTab = new KAction( i18n( "Open in &Background Tab" ), "tab_new_bg", 0, this, SLOT( slotPopupNewTab() ), actionCollection(), "openintab" );
   actNewTab->setStatusText( i18n( "Open the document in a new background tab" ) );
@@ -3869,4 +3892,5 @@ void KonqMainWindow::slotPopupMenu( KXML
   delete actNewTab;
   delete actNewTabFront;
+  delete actNewWindow;
 
   //kdDebug(1202) << "-------- KonqMainWindow::slotPopupMenu() - m_oldView = " << m_oldView << ", currentView = " << currentView

--- kdebase/konqueror/konq_mainwindow.h  #1.404:1.405
@@ -402,4 +402,5 @@ protected slots:
   void slotBreakOffTabPopupDelayed();
 
+  void slotPopupNewWindow();
   void slotPopupNewTab();
   void slotPopupNewTabAtFront();