[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_0_BRANCH: kdelibs/kioslave/http
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-07-04 13:30:32
[Download RAW message or body]

CVS commit by waba: 

Sanitize referrer.


  M +25 -12    http.cc   1.470.2.21


--- kdelibs/kioslave/http/http.cc  #1.470.2.20:1.470.2.21
@@ -196,16 +196,29 @@ void HTTPProtocol::resetSessionSettings(
   m_request.window = config()->readEntry("window-id");
 
-  bool sendReferrer = config()->readBoolEntry("SendReferrer", true);
-  if ( sendReferrer )
-     m_request.referrer = metaData("referrer");
-  else
+
      m_request.referrer = QString::null;
+  if ( config()->readBoolEntry("SendReferrer", true) )
+  {
+     KURL referrerURL = metaData("referrer");
+     if (referrerURL.isValid())
+     {
+        // Sanitize
+        QString protocol = referrerURL.protocol();
+        if (protocol.startsWith("webdav"))
+        {
+           protocol.replace(0, 6, "http");
+           referrerURL.setProtocol(protocol);
+        }
      
-  if (!m_request.referrer.startsWith("http"))
+        if ((protocol == "http") || 
+            ((protocol == "https") && ((m_protocol == "https") || (m_protocol == "webdavs")))
+           )
   {
-     if (m_request.referrer.startsWith("webdav"))
-        m_request.referrer.replace(0, 6, "http");
-     else
-        m_request.referrer = QString::null;
+           referrerURL.setRef(QString::null);
+           referrerURL.setUser(QString::null);
+           referrerURL.setPass(QString::null);
+           m_request.referrer = referrerURL.url();
+        }
+     }
   }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic