summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMelanie Clements <melanielc@google.com>2010-08-20 14:19:20 -0400
committerJean-Baptiste Queru <jbq@google.com>2010-08-30 14:54:01 -0700
commitff93a851c578d0b570c84b3a83a41a4930e7107c (patch)
tree0c45fb507e0b5153bd97cb18eefd12e7ede298a7
parent5dc34a8555dde1ae4a2c174870c4296cc44f8a22 (diff)
downloadexternal_webkit-ff93a851c578d0b570c84b3a83a41a4930e7107c.zip
external_webkit-ff93a851c578d0b570c84b3a83a41a4930e7107c.tar.gz
external_webkit-ff93a851c578d0b570c84b3a83a41a4930e7107c.tar.bz2
Bug fix 2337042 <base> URL + <img> URL = URL that starts with "/."
The Android browser inserts "/." at the beginning of the URL path when processing an <img> in an HTML document with a <base> tag. This does not cause any errors but should be fixed to comply with RFC 3986 section 5.4. This only happens at the first pass of the URL parsing, at the second pass where the base and path are parsed together this is dealt with correctly. I am therefore fixing it by modifying the parse() method in KURL to check for a trailing '.' at the end of the base segment. Change-Id: I0d641c8619e00aa2b08a33e271ef863cee5ed7ad
-rw-r--r--WebCore/platform/KURL.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/WebCore/platform/KURL.cpp b/WebCore/platform/KURL.cpp
index 79bb6e2..e790cc0 100644
--- a/WebCore/platform/KURL.cpp
+++ b/WebCore/platform/KURL.cpp
@@ -1287,6 +1287,13 @@ void KURL::parse(const char* url, const String* originalString)
if (m_protocolInHTTPFamily && hierarchical && pathEnd == pathStart)
*p++ = '/';
+#if PLATFORM(ANDROID)
+ // Remove any trailing '.' from base, in order to conform to RFC 3986 section 5.4
+ if (p[-1] == '.') {
+ p--;
+ }
+#endif /* PLATFORM(ANDROID) */
+
// add path, escaping bad characters
if (!hierarchical || !hasSlashDotOrDotDot(url))
appendEscapingBadChars(p, url + pathStart, pathEnd - pathStart);