[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:26:37 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f6226f41d47a0111db4f20a11e5b46d7b0a65e62
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jul 23 23:24:09 2002 +0000

    top level:
    
            * Tests/kde/kurl-test.chk: Updated test results to match what real web browsers
    	need to do rather than what the RFC says for paths beginning with "../" or "./".
            * Tests/kde/kurl-test.cpp: (main): Add comments for tests where the results are
    	not matching the RFC.
    
    WebCore:
    
    	- fixed 3004818 -- relative urls are assembled incorrectly at ticketmaster
    	- fixed 2999279 -- Invalid URI in request at subpage of swatch.com
    
    	The issue here is URLs with paths that start with "/../". RFC 2396 says one
    	thing, and that's what CFURL does. But real web browsers do another thing.
    
            * kwq/KWQKURL.mm:
            (KURL::KWQKURLPrivate::KWQKURLPrivate): Clean up a bit by removing unneeded init().
            (escapeQString): Don't make a copy of the passed-in QString.
            (pathEndsWithSlash): Don't make a copy of the passed-in QString.
            (copyEscapedPath): Make this a static function instead of extern.
            (KURL::KWQKURLPrivate::decompose): Add the new "../" and "./" logic.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1641 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index a9580c5..1bb5ead 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,18 @@
+2002-07-23  Darin Adler  <darin at apple.com>
+
+	- fixed 3004818 -- relative urls are assembled incorrectly at ticketmaster
+	- fixed 2999279 -- Invalid URI in request at subpage of swatch.com
+
+	The issue here is URLs with paths that start with "/../". RFC 2396 says one
+	thing, and that's what CFURL does. But real web browsers do another thing.
+
+        * kwq/KWQKURL.mm:
+        (KURL::KWQKURLPrivate::KWQKURLPrivate): Clean up a bit by removing unneeded init().
+        (escapeQString): Don't make a copy of the passed-in QString.
+        (pathEndsWithSlash): Don't make a copy of the passed-in QString.
+        (copyEscapedPath): Make this a static function instead of extern.
+        (KURL::KWQKURLPrivate::decompose): Add the new "../" and "./" logic.
+
 2002-07-23  David Hyatt  <hyatt at apple.com>
 
         * khtml/rendering/font.cpp:
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index a9580c5..1bb5ead 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,18 @@
+2002-07-23  Darin Adler  <darin at apple.com>
+
+	- fixed 3004818 -- relative urls are assembled incorrectly at ticketmaster
+	- fixed 2999279 -- Invalid URI in request at subpage of swatch.com
+
+	The issue here is URLs with paths that start with "/../". RFC 2396 says one
+	thing, and that's what CFURL does. But real web browsers do another thing.
+
+        * kwq/KWQKURL.mm:
+        (KURL::KWQKURLPrivate::KWQKURLPrivate): Clean up a bit by removing unneeded init().
+        (escapeQString): Don't make a copy of the passed-in QString.
+        (pathEndsWithSlash): Don't make a copy of the passed-in QString.
+        (copyEscapedPath): Make this a static function instead of extern.
+        (KURL::KWQKURLPrivate::decompose): Add the new "../" and "./" logic.
+
 2002-07-23  David Hyatt  <hyatt at apple.com>
 
         * khtml/rendering/font.cpp:
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a9580c5..1bb5ead 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2002-07-23  Darin Adler  <darin at apple.com>
+
+	- fixed 3004818 -- relative urls are assembled incorrectly at ticketmaster
+	- fixed 2999279 -- Invalid URI in request at subpage of swatch.com
+
+	The issue here is URLs with paths that start with "/../". RFC 2396 says one
+	thing, and that's what CFURL does. But real web browsers do another thing.
+
+        * kwq/KWQKURL.mm:
+        (KURL::KWQKURLPrivate::KWQKURLPrivate): Clean up a bit by removing unneeded init().
+        (escapeQString): Don't make a copy of the passed-in QString.
+        (pathEndsWithSlash): Don't make a copy of the passed-in QString.
+        (copyEscapedPath): Make this a static function instead of extern.
+        (KURL::KWQKURLPrivate::decompose): Add the new "../" and "./" logic.
+
 2002-07-23  David Hyatt  <hyatt at apple.com>
 
         * khtml/rendering/font.cpp:
diff --git a/WebCore/kwq/KWQKURL.mm b/WebCore/kwq/KWQKURL.mm
index 203c94c..7bdbcd4 100644
--- a/WebCore/kwq/KWQKURL.mm
+++ b/WebCore/kwq/KWQKURL.mm
@@ -35,7 +35,6 @@ public:
     KWQKURLPrivate(const KWQKURLPrivate &other);
     ~KWQKURLPrivate();
 
-    void init(const QString &);
     void makeRef();
     void decompose();
     void compose();
@@ -59,11 +58,12 @@ public:
 
 KURL::KWQKURLPrivate::KWQKURLPrivate(const QString &url) :
     urlRef(NULL),
+    sURL(url),
     iPort(0),
     addedSlash(false),
     refCount(0)
 {
-    init(url);
+    decompose();
 }
 
 KURL::KWQKURLPrivate::KWQKURLPrivate(const KWQKURLPrivate &other) :
@@ -90,14 +90,6 @@ KURL::KWQKURLPrivate::~KWQKURLPrivate()
     }
 }
 
-void KURL::KWQKURLPrivate::init(const QString &s)
-{
-    // Save original string
-    sURL = s;
-
-    decompose();
-}
-
 void KURL::KWQKURLPrivate::makeRef()
 {
     // Not a path and no scheme, so bail out, because CFURL considers such
@@ -109,9 +101,9 @@ void KURL::KWQKURLPrivate::makeRef()
 
     // Create CFURLRef object
     if (sURL.length() > 0 && sURL[0] == '/') {
-        sURL = (QString("file://")) + sURL;
+        sURL = "file://" + sURL;
     } else if (sURL.startsWith("file:/") && !sURL.startsWith("file://")) {
-        sURL = (QString("file:///") + sURL.mid(6));
+        sURL = "file:///" + sURL.mid(6);
     }
 
     QString sURLMaybeAddSlash;
@@ -149,12 +141,12 @@ static inline QString CFStringToQString(CFStringRef cfs)
     return qs;
 }
 
-static inline QString escapeQString(QString str)
+static inline QString escapeQString(const QString &str)
 {
     return CFStringToQString(CFURLCreateStringByAddingPercentEscapes(NULL, str.getCFMutableString(), NULL, NULL, kCFStringEncodingUTF8));
 }
 
-static bool pathEndsWithSlash(QString sURL)
+static bool pathEndsWithSlash(const QString &sURL)
 {
     int endOfPath = sURL.findRev('?', sURL.findRev('#'));
     if (endOfPath == -1) {
@@ -167,8 +159,7 @@ static bool pathEndsWithSlash(QString sURL)
     }
 }
 
-
-CFStringRef KWQCFURLCopyEscapedPath(CFURLRef anURL)
+static CFStringRef copyEscapedPath(CFURLRef anURL)
 {
     NSRange path;
     CFStringRef urlString = CFURLGetString(anURL);
@@ -209,7 +200,7 @@ void KURL::KWQKURLPrivate::decompose()
 
     sQuery = CFStringToQString(CFURLCopyQueryString(urlRef, NULL));
     if (!sQuery.isEmpty()) {
-        sQuery = QString("?") + sQuery;
+        sQuery = "?" + sQuery;
     }
 
     if (CFURLCanBeDecomposed(urlRef)) {
@@ -218,14 +209,36 @@ void KURL::KWQKURLPrivate::decompose()
 	    escapedPath = "";
 	} else {
 	    sPath = CFStringToQString(CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle));
-	    escapedPath = CFStringToQString(KWQCFURLCopyEscapedPath(urlRef));
+	    escapedPath = CFStringToQString(copyEscapedPath(urlRef));
 	}
+        
+        // Remove "../" or "./" from the start of the path.
+        // This is not what RFC 2396 says to do, but it's what other browsers do.
+        if (sPath.startsWith("/.")) {
+            for (;;) {
+                if (sPath.startsWith("/./")) {
+                    sPath.remove(0, 2);
+                } else if (sPath.startsWith("/../")) {
+                    sPath.remove(0, 3);
+                } else {
+                    break;
+                }
+            }
+            for (;;) {
+                if (escapedPath.startsWith("/./")) {
+                    escapedPath.remove(0, 2);
+                } else if (escapedPath.startsWith("/../")) {
+                    escapedPath.remove(0, 3);
+                } else {
+                    break;
+                }
+            }
+        }
+        
 	QString param = CFStringToQString(CFURLCopyParameterString(urlRef, CFSTR("")));
 	if (!param.isEmpty()) {
 	    sPath += ";" + param;
-	    QString escapedParam = CFStringToQString(CFURLCopyParameterString(urlRef, NULL));
-
-	    escapedPath += ";" + escapedParam;
+	    escapedPath += ";" + CFStringToQString(CFURLCopyParameterString(urlRef, NULL));
 	}
 
 	if (pathEndsWithSlash(sURL) && sPath.right(1) != "/") {
@@ -237,8 +250,8 @@ void KURL::KWQKURLPrivate::decompose()
     }
 
     if (sProtocol == "file" && !hostName.isEmpty() && hostName != "localhost") {
-        sPath = QString("//") + hostName + sPath;
-	escapedPath = QString("//") + hostName + escapedPath;
+        sPath = "//" + hostName + sPath;
+	escapedPath = "//" + hostName + escapedPath;
     }
 
     // could lead to poor performance - perhaps compose manually in ::url?
@@ -367,7 +380,7 @@ QString KURL::normalizeURLString(const QString &s)
 
     // Special handling for paths
     if (!qurl.isEmpty() && qurl[0] == '/') {
-        qurl = QString("file:") + qurl;
+        qurl = "file:" + qurl;
     }
 
     // FIXME: Do we really have to parse even the simplest URLs into pieces just to normalize them?
@@ -378,11 +391,11 @@ QString KURL::normalizeURLString(const QString &s)
     qurl = d->sURL;
 
     if (qurl.startsWith("file:///")) {
-        qurl = QString("file:/") + qurl.mid(8);
+        qurl = "file:/" + qurl.mid(8);
     } else if (qurl == "file://localhost") {
-        qurl = QString("file:");
+        qurl = "file:";
     } else if (qurl.startsWith("file://localhost/")) {
-        qurl = QString("file:/") + qurl.mid(17);
+        qurl = "file:/" + qurl.mid(17);
     }
 
     CFDictionarySetValue(NormalizedURLCache, s.getCFMutableString(), qurl.getCFMutableString());
@@ -591,7 +604,7 @@ QString KURL::prettyURL(int trailing) const
         return d->sURL;
     }
 
-    QString result =  d->sProtocol + ":";
+    QString result = d->sProtocol + ":";
 
     if (!d->sHost.isEmpty()) {
         result += "//";
@@ -633,7 +646,6 @@ void KURL::swap(KURL &other)
 {
     KWQRefPtr<KWQKURLPrivate> tmpD = other.d;
     QString tmpString = other.urlString;
-    
     other.d = d;
     d = tmpD;
     other.urlString = urlString;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list