[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
ukai at chromium.org
ukai at chromium.org
Tue Jan 5 23:40:37 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 95f0023a3fb3a9f7f3c1a1f76cd3d0617ebbacae
Author: ukai at chromium.org <ukai at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 2 08:19:47 2009 +0000
2009-12-02 Fumitoshi Ukai <ukai at chromium.org>
Reviewed by Alexey Proskuryakov.
WebSocket handshake check query component of URL
https://bugs.webkit.org/show_bug.cgi?id=31617
* websocket/tests/echo-location_wsh.py: Added.
* websocket/tests/no-query_wsh.py: Added.
* websocket/tests/script-tests/url-with-credential.js: Added.
* websocket/tests/script-tests/url-with-empty-query.js: Added.
* websocket/tests/script-tests/url-with-fragment.js: Added.
* websocket/tests/script-tests/url-with-query-for-no-query.js: Added.
* websocket/tests/script-tests/url-with-query.js: Added.
* websocket/tests/url-with-credential-expected.txt: Added.
* websocket/tests/url-with-credential.html: Added.
* websocket/tests/url-with-empty-query-expected.txt: Added.
* websocket/tests/url-with-empty-query.html: Added.
* websocket/tests/url-with-fragment-expected.txt: Added.
* websocket/tests/url-with-fragment.html: Added.
* websocket/tests/url-with-query-expected.txt: Added.
* websocket/tests/url-with-query-for-no-query-expected.txt: Added.
* websocket/tests/url-with-query-for-no-query.html: Added.
* websocket/tests/url-with-query.html: Added.
2009-12-02 Fumitoshi Ukai <ukai at chromium.org>
Reviewed by Alexey Proskuryakov.
WebSocket handshake check query component of URL
https://bugs.webkit.org/show_bug.cgi?id=31617
Tests: websocket/tests/url-with-credential.html
websocket/tests/url-with-empty-query.html
websocket/tests/url-with-fragment.html
websocket/tests/url-with-query-for-no-query.html
websocket/tests/url-with-query.html
* platform/KURLGoogle.cpp:
(WebCore::KURL::query): returns a null if query is not specified and returns an empty if query is specified but empty.
* websockets/WebSocketHandshake.cpp:
(WebCore::resourceName): added. add query component to path if specified.
(WebCore::WebSocketHandshake::clientLocation):
(WebCore::WebSocketHandshake::clientHandshakeMessage):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 613acd9..e8bf90f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,28 @@
+2009-12-02 Fumitoshi Ukai <ukai at chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ WebSocket handshake check query component of URL
+ https://bugs.webkit.org/show_bug.cgi?id=31617
+
+ * websocket/tests/echo-location_wsh.py: Added.
+ * websocket/tests/no-query_wsh.py: Added.
+ * websocket/tests/script-tests/url-with-credential.js: Added.
+ * websocket/tests/script-tests/url-with-empty-query.js: Added.
+ * websocket/tests/script-tests/url-with-fragment.js: Added.
+ * websocket/tests/script-tests/url-with-query-for-no-query.js: Added.
+ * websocket/tests/script-tests/url-with-query.js: Added.
+ * websocket/tests/url-with-credential-expected.txt: Added.
+ * websocket/tests/url-with-credential.html: Added.
+ * websocket/tests/url-with-empty-query-expected.txt: Added.
+ * websocket/tests/url-with-empty-query.html: Added.
+ * websocket/tests/url-with-fragment-expected.txt: Added.
+ * websocket/tests/url-with-fragment.html: Added.
+ * websocket/tests/url-with-query-expected.txt: Added.
+ * websocket/tests/url-with-query-for-no-query-expected.txt: Added.
+ * websocket/tests/url-with-query-for-no-query.html: Added.
+ * websocket/tests/url-with-query.html: Added.
+
2009-12-01 Shinichiro Hamaji <hamaji at chromium.org>
Reviewed by Eric Seidel.
diff --git a/LayoutTests/websocket/tests/echo-location_wsh.py b/LayoutTests/websocket/tests/echo-location_wsh.py
new file mode 100644
index 0000000..3390570
--- /dev/null
+++ b/LayoutTests/websocket/tests/echo-location_wsh.py
@@ -0,0 +1,39 @@
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+from mod_pywebsocket import msgutil
+
+
+def web_socket_do_extra_handshake(request):
+ pass
+
+
+def web_socket_transfer_data(request):
+ print request.ws_location
+ msgutil.send_message(request, request.ws_location)
diff --git a/LayoutTests/websocket/tests/no-query_wsh.py b/LayoutTests/websocket/tests/no-query_wsh.py
new file mode 100644
index 0000000..2b79615
--- /dev/null
+++ b/LayoutTests/websocket/tests/no-query_wsh.py
@@ -0,0 +1,38 @@
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+from mod_pywebsocket import msgutil
+
+
+def web_socket_do_extra_handshake(request):
+ request.ws_location = request.ws_resource.split('?', 1)[0]
+
+
+def web_socket_transfer_data(request):
+ msgutil.send_message(request, request.ws_location)
diff --git a/LayoutTests/websocket/tests/script-tests/url-with-credential.js b/LayoutTests/websocket/tests/script-tests/url-with-credential.js
new file mode 100644
index 0000000..b4b7235
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/url-with-credential.js
@@ -0,0 +1,37 @@
+description("Make sure handshake with URL with credentail info success.");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var url = "ws://user:pass@127.0.0.1:8880/websocket/tests/echo-location";
+var handshake_success = false;
+var ws_location;
+
+function endTest()
+{
+ clearTimeout(timeoutID);
+ shouldBeTrue("handshake_success");
+ shouldBe("ws_location", '"ws://127.0.0.1:8880/websocket/tests/echo-location"');
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+debug("url=" + url);
+var ws = new WebSocket(url);
+ws.onopen = function () {
+ debug("WebSocket is open");
+ handshake_success = true;
+};
+ws.onmessage = function (evt) {
+ ws_location = evt.data;
+ debug("received:" + ws_location);
+ ws.close();
+};
+ws.onclose = function () {
+ debug("WebSocket is closed");
+ endTest();
+};
+var timeoutID = setTimeout("endTest()", 2000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/script-tests/url-with-empty-query.js b/LayoutTests/websocket/tests/script-tests/url-with-empty-query.js
new file mode 100644
index 0000000..0b478b6
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/url-with-empty-query.js
@@ -0,0 +1,37 @@
+description("Make sure handshake with URL with empty query components success.");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var url = "ws://127.0.0.1:8880/websocket/tests/echo-location?";
+var handshake_success = false;
+var ws_location;
+
+function endTest()
+{
+ clearTimeout(timeoutID);
+ shouldBeTrue("handshake_success");
+ shouldBe("ws_location", "url");
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+debug("url=" + url);
+var ws = new WebSocket(url);
+ws.onopen = function () {
+ debug("WebSocket is open");
+ handshake_success = true;
+};
+ws.onmessage = function (evt) {
+ ws_location = evt.data;
+ debug("received:" + ws_location);
+ ws.close();
+};
+ws.onclose = function () {
+ debug("WebSocket is closed");
+ endTest();
+};
+var timeoutID = setTimeout("endTest()", 2000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/script-tests/url-with-fragment.js b/LayoutTests/websocket/tests/script-tests/url-with-fragment.js
new file mode 100644
index 0000000..73e8a01
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/url-with-fragment.js
@@ -0,0 +1,37 @@
+description("Make sure handshake with URL with fragment components success.");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var url = "ws://127.0.0.1:8880/websocket/tests/echo-location#fragment";
+var handshake_success = false;
+var ws_location;
+
+function endTest()
+{
+ clearTimeout(timeoutID);
+ shouldBeTrue("handshake_success");
+ shouldBe("ws_location", '"ws://127.0.0.1:8880/websocket/tests/echo-location"');
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+debug("url=" + url);
+var ws = new WebSocket(url);
+ws.onopen = function () {
+ debug("WebSocket is open");
+ handshake_success = true;
+};
+ws.onmessage = function (evt) {
+ ws_location = evt.data;
+ debug("received:" + ws_location);
+ ws.close();
+};
+ws.onclose = function () {
+ debug("WebSocket is closed");
+ endTest();
+};
+var timeoutID = setTimeout("endTest()", 2000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/script-tests/url-with-query-for-no-query.js b/LayoutTests/websocket/tests/script-tests/url-with-query-for-no-query.js
new file mode 100644
index 0000000..d1d112b
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/url-with-query-for-no-query.js
@@ -0,0 +1,37 @@
+description("Make sure handshake with URL with query components fails against server that doesn't support query component.");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var url = "ws://127.0.0.1:8880/websocket/tests/no-query-support?";
+var handshake_success = false;
+var ws_location;
+
+function endTest()
+{
+ clearTimeout(timeoutID);
+ shouldBeFalse("handshake_success");
+ shouldBeUndefined("ws_location");
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+debug("url=" + url);
+var ws = new WebSocket(url);
+ws.onopen = function () {
+ debug("WebSocket is open");
+ handshake_success = true;
+};
+ws.onmessge = function (evt) {
+ ws_location = evt.data;
+ debug("received:" + ws_location);
+ ws.close();
+};
+ws.onclose = function () {
+ debug("WebSocket is closed");
+ endTest();
+};
+var timeoutID = setTimeout("endTest()", 2000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/script-tests/url-with-query.js b/LayoutTests/websocket/tests/script-tests/url-with-query.js
new file mode 100644
index 0000000..618628b
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/url-with-query.js
@@ -0,0 +1,37 @@
+description("Make sure handshake with URL with query components success.");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var url = "ws://127.0.0.1:8880/websocket/tests/echo-location?q=v";
+var handshake_success = false;
+var ws_location;
+
+function endTest()
+{
+ clearTimeout(timeoutID);
+ shouldBeTrue("handshake_success");
+ shouldBe("ws_location", "url");
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+debug("url=" + url);
+var ws = new WebSocket(url);
+ws.onopen = function () {
+ debug("WebSocket is open");
+ handshake_success = true;
+};
+ws.onmessage = function (evt) {
+ ws_location = evt.data;
+ debug("received:" + ws_location);
+ ws.close();
+};
+ws.onclose = function () {
+ debug("WebSocket is closed");
+ endTest();
+};
+var timeoutID = setTimeout("endTest()", 2000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/url-with-credential-expected.txt b/LayoutTests/websocket/tests/url-with-credential-expected.txt
new file mode 100644
index 0000000..da79d52
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-credential-expected.txt
@@ -0,0 +1,14 @@
+Make sure handshake with URL with credentail info success.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+url=ws://user:pass@127.0.0.1:8880/websocket/tests/echo-location
+WebSocket is open
+received:ws://127.0.0.1:8880/websocket/tests/echo-location
+WebSocket is closed
+PASS handshake_success is true
+PASS ws_location is "ws://127.0.0.1:8880/websocket/tests/echo-location"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/url-with-credential.html b/LayoutTests/websocket/tests/url-with-credential.html
new file mode 100644
index 0000000..7ac556a
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-credential.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src="script-tests/url-with-credential.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/url-with-empty-query-expected.txt b/LayoutTests/websocket/tests/url-with-empty-query-expected.txt
new file mode 100644
index 0000000..f2cb9e3
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-empty-query-expected.txt
@@ -0,0 +1,14 @@
+Make sure handshake with URL with empty query components success.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+url=ws://127.0.0.1:8880/websocket/tests/echo-location?
+WebSocket is open
+received:ws://127.0.0.1:8880/websocket/tests/echo-location?
+WebSocket is closed
+PASS handshake_success is true
+PASS ws_location is url
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/url-with-empty-query.html b/LayoutTests/websocket/tests/url-with-empty-query.html
new file mode 100644
index 0000000..227f0b3
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-empty-query.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src="script-tests/url-with-empty-query.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/url-with-fragment-expected.txt b/LayoutTests/websocket/tests/url-with-fragment-expected.txt
new file mode 100644
index 0000000..27c764f
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-fragment-expected.txt
@@ -0,0 +1,14 @@
+Make sure handshake with URL with fragment components success.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+url=ws://127.0.0.1:8880/websocket/tests/echo-location#fragment
+WebSocket is open
+received:ws://127.0.0.1:8880/websocket/tests/echo-location
+WebSocket is closed
+PASS handshake_success is true
+PASS ws_location is "ws://127.0.0.1:8880/websocket/tests/echo-location"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/url-with-fragment.html b/LayoutTests/websocket/tests/url-with-fragment.html
new file mode 100644
index 0000000..2b34770
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-fragment.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src="script-tests/url-with-fragment.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/url-with-query-expected.txt b/LayoutTests/websocket/tests/url-with-query-expected.txt
new file mode 100644
index 0000000..49e7c28
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-query-expected.txt
@@ -0,0 +1,14 @@
+Make sure handshake with URL with query components success.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+url=ws://127.0.0.1:8880/websocket/tests/echo-location?q=v
+WebSocket is open
+received:ws://127.0.0.1:8880/websocket/tests/echo-location?q=v
+WebSocket is closed
+PASS handshake_success is true
+PASS ws_location is url
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/url-with-query-for-no-query-expected.txt b/LayoutTests/websocket/tests/url-with-query-for-no-query-expected.txt
new file mode 100644
index 0000000..39af77c
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-query-for-no-query-expected.txt
@@ -0,0 +1,12 @@
+Make sure handshake with URL with query components fails against server that doesn't support query component.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+url=ws://127.0.0.1:8880/websocket/tests/no-query-support?
+WebSocket is closed
+PASS handshake_success is false
+PASS ws_location is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/url-with-query-for-no-query.html b/LayoutTests/websocket/tests/url-with-query-for-no-query.html
new file mode 100644
index 0000000..7b0fc39
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-query-for-no-query.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src="script-tests/url-with-query-for-no-query.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/url-with-query.html b/LayoutTests/websocket/tests/url-with-query.html
new file mode 100644
index 0000000..ac90502
--- /dev/null
+++ b/LayoutTests/websocket/tests/url-with-query.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src="script-tests/url-with-query.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 78a5700..4bbfb9a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-12-02 Fumitoshi Ukai <ukai at chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ WebSocket handshake check query component of URL
+ https://bugs.webkit.org/show_bug.cgi?id=31617
+
+ Tests: websocket/tests/url-with-credential.html
+ websocket/tests/url-with-empty-query.html
+ websocket/tests/url-with-fragment.html
+ websocket/tests/url-with-query-for-no-query.html
+ websocket/tests/url-with-query.html
+
+ * platform/KURLGoogle.cpp:
+ (WebCore::KURL::query): returns a null if query is not specified and returns an empty if query is specified but empty.
+ * websockets/WebSocketHandshake.cpp:
+ (WebCore::resourceName): added. add query component to path if specified.
+ (WebCore::WebSocketHandshake::clientLocation):
+ (WebCore::WebSocketHandshake::clientHandshakeMessage):
+
2009-12-01 David Levin <levin at chromium.org>
Reviewed by Eric Seidel.
diff --git a/WebCore/platform/KURLGoogle.cpp b/WebCore/platform/KURLGoogle.cpp
index 763bf3b..5604883 100644
--- a/WebCore/platform/KURLGoogle.cpp
+++ b/WebCore/platform/KURLGoogle.cpp
@@ -552,7 +552,10 @@ String KURL::query() const
// Bug: https://bugs.webkit.org/show_bug.cgi?id=21015 this function returns
// an empty string when the query is empty rather than a null (not sure
// which is right).
- return String("", 0);
+ // Returns a null if the query is not specified, instead of empty.
+ if (m_url.m_parsed.query.is_valid())
+ return String("", 0);
+ return String();
}
String KURL::path() const
diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp
index 691fa1c..d1da443 100644
--- a/WebCore/websockets/WebSocketHandshake.cpp
+++ b/WebCore/websockets/WebSocketHandshake.cpp
@@ -74,6 +74,13 @@ static String extractResponseCode(const char* header, int len)
return String(space1 + 1, space2 - space1 - 1);
}
+static String resourceName(const KURL& url)
+{
+ if (url.query().isNull())
+ return url.path();
+ return url.path() + "?" + url.query();
+}
+
WebSocketHandshake::WebSocketHandshake(const KURL& url, const String& protocol, ScriptExecutionContext* context)
: m_url(url)
, m_clientProtocol(protocol)
@@ -139,7 +146,7 @@ String WebSocketHandshake::clientLocation() const
builder.append(String::number(m_url.port()));
}
}
- builder.append(m_url.path());
+ builder.append(resourceName(m_url));
return builder.toString();
}
@@ -148,11 +155,7 @@ CString WebSocketHandshake::clientHandshakeMessage() const
StringBuilder builder;
builder.append("GET ");
- builder.append(m_url.path());
- if (!m_url.query().isEmpty()) {
- builder.append("?");
- builder.append(m_url.query());
- }
+ builder.append(resourceName(m_url));
builder.append(" HTTP/1.1\r\n");
builder.append("Upgrade: WebSocket\r\n");
builder.append("Connection: Upgrade\r\n");
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list