Commit 48a35d0d authored by ap@webkit.org's avatar ap@webkit.org

Reviewed by Darin.

        https://bugs.webkit.org/show_bug.cgi?id=19169
        <rdar://5952342> REGRESSION: nakarte.ru searches don't work

        Test: http/tests/xmlhttprequest/encode-request-url.html

        * platform/KURL.cpp: (WebCore::KURL::init): Don't allow UTF-8 encoded data to be implicitly
        converted to String, as it will be encoded again by parse().



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9ff91796
2008-05-21 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=19169
<rdar://5952342> REGRESSION: nakarte.ru searches don't work
* http/tests/xmlhttprequest/encode-request-url-expected.txt: Added.
* http/tests/xmlhttprequest/encode-request-url.html: Added.
* http/tests/xmlhttprequest/resources/print-query.cgi: Added.
2008-05-20 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
Test how URLs are encoded.
abs-path: PASS
rel-path: PASS
absolute: PASS
<head><meta charset="utf-8"></head>
<body>
<p>Test how URLs are encoded.</p>
<ol id=result></ol>
<script>
function log(message)
{
var item = document.createElement("li");
item.appendChild(document.createTextNode(message));
document.getElementById("result").appendChild(item);
}
if (window.layoutTestController)
layoutTestController.dumpAsText();
var req = new XMLHttpRequest;
req.open("GET", "/xmlhttprequest/resources/print-query.cgi?Проверка", false);
req.send();
log("abs-path: " + (req.responseText == "%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0" ? "PASS" : "FAIL (" + req.responseText + ")"));
req.open("GET", "resources/print-query.cgi?Проверка", false);
req.send();
log("rel-path: " + (req.responseText == "%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0" ? "PASS" : "FAIL (" + req.responseText + ")"));
req.open("GET", document.URL.replace(/encode-request-url\.html/, "") + "resources/print-query.cgi?Проверка", false);
req.send();
log("absolute: " + (req.responseText == "%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0" ? "PASS" : "FAIL (" + req.responseText + ")"));
</script>
</body>
#!/usr/bin/perl -w
use CGI qw(:standard);
my $cgi = new CGI;
print "Content-type: text/plain\n\n";
print $ENV{"QUERY_STRING"};
2008-05-21 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
https://bugs.webkit.org/show_bug.cgi?id=19169
<rdar://5952342> REGRESSION: nakarte.ru searches don't work
Test: http/tests/xmlhttprequest/encode-request-url.html
* platform/KURL.cpp: (WebCore::KURL::init): Don't allow UTF-8 encoded data to be implicitly
converted to String, as it will be encoded again by parse().
2008-05-21 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon.
......@@ -398,7 +398,7 @@ void KURL::init(const KURL& base, const String& relative, const TextEncoding& en
// unless the relative URL is a single fragment.
if (!base.isHierarchical()) {
if (str[0] == '#')
parse(base.m_string.left(base.m_queryEnd) + str);
parse(base.m_string.left(base.m_queryEnd) + (allASCII ? String(str) : String::fromUTF8(str)));
else {
m_string = relative;
invalidate();
......@@ -414,20 +414,20 @@ void KURL::init(const KURL& base, const String& relative, const TextEncoding& en
break;
case '#':
// must be fragment-only reference
parse(base.m_string.left(base.m_queryEnd) + str);
parse(base.m_string.left(base.m_queryEnd) + (allASCII ? String(str) : String::fromUTF8(str)));
break;
case '?':
// query-only reference, special case needed for non-URL results
parse(base.m_string.left(base.m_pathEnd) + str);
parse(base.m_string.left(base.m_pathEnd) + (allASCII ? String(str) : String::fromUTF8(str)));
break;
case '/':
// must be net-path or absolute-path reference
if (str[1] == '/') {
// net-path
parse(base.m_string.left(base.m_schemeEnd + 1) + str);
parse(base.m_string.left(base.m_schemeEnd + 1) + (allASCII ? String(str) : String::fromUTF8(str)));
} else {
// abs-path
parse(base.m_string.left(base.m_portEnd) + str);
parse(base.m_string.left(base.m_portEnd) + (allASCII ? String(str) : String::fromUTF8(str)));
}
break;
default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment