Title: [92260] trunk
- Revision
- 92260
- Author
- [email protected]
- Date
- 2011-08-02 21:37:51 -0700 (Tue, 02 Aug 2011)
Log Message
WebSocket: Should be closed by receiving invalid continuation frame.
https://bugs.webkit.org/show_bug.cgi?id=65527
Patch by Takashi Toyoshima <[email protected]> on 2011-08-02
Reviewed by Kent Tamura.
Source/WebCore:
Test: http/tests/websocket/tests/hybi/invalid-continuation.html
* websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::processFrame):
LayoutTests:
* http/tests/websocket/tests/hybi/invalid-continuation-expected.txt: Added.
* http/tests/websocket/tests/hybi/invalid-continuation.html: Added.
* http/tests/websocket/tests/hybi/invalid-continuation_wsh.py: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (92259 => 92260)
--- trunk/LayoutTests/ChangeLog 2011-08-03 04:26:52 UTC (rev 92259)
+++ trunk/LayoutTests/ChangeLog 2011-08-03 04:37:51 UTC (rev 92260)
@@ -1,3 +1,15 @@
+2011-08-02 Takashi Toyoshima <[email protected]>
+
+ WebSocket: Should be closed by receiving invalid continuation frame.
+
+ https://bugs.webkit.org/show_bug.cgi?id=65527
+
+ Reviewed by Kent Tamura.
+
+ * http/tests/websocket/tests/hybi/invalid-continuation-expected.txt: Added.
+ * http/tests/websocket/tests/hybi/invalid-continuation.html: Added.
+ * http/tests/websocket/tests/hybi/invalid-continuation_wsh.py: Added.
+
2011-08-02 James Robinson <[email protected]>
More expectation updates for r92255
Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/invalid-continuation-expected.txt (0 => 92260)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/invalid-continuation-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/invalid-continuation-expected.txt 2011-08-03 04:37:51 UTC (rev 92260)
@@ -0,0 +1,12 @@
+CONSOLE MESSAGE: line 0: Received unexpected continuation frame.
+Test whether WebSocket aborts the connection when it receives an unexpected continuation frame without any leading text or binary frame.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+onopen() was called.
+onclose() was called.
+PASS closeEvent.wasClean is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/invalid-continuation.html (0 => 92260)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/invalid-continuation.html (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/invalid-continuation.html 2011-08-03 04:37:51 UTC (rev 92260)
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description("Test whether WebSocket aborts the connection when it receives an unexpected continuation frame without any leading text or binary frame.");
+
+window.jsTestIsAsync = true;
+if (window.layoutTestController)
+ layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
+
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/invalid-continuation");
+var closeEvent;
+
+ws._onopen_ = function()
+{
+ debug("onopen() was called.");
+};
+
+ws._onmessage_ = function(event)
+{
+ var message = event.data;
+ testFailed("onmessage() was called. (message = \"" + message + "\")");
+};
+
+ws._onclose_ = function(event)
+{
+ debug("onclose() was called.");
+ closeEvent = event;
+ shouldBeFalse("closeEvent.wasClean");
+ finishJSTest();
+};
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/invalid-continuation_wsh.py (0 => 92260)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/invalid-continuation_wsh.py (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/invalid-continuation_wsh.py 2011-08-03 04:37:51 UTC (rev 92260)
@@ -0,0 +1,16 @@
+from mod_pywebsocket import common
+from mod_pywebsocket import stream
+
+def web_socket_do_extra_handshake(request):
+ pass
+
+
+def web_socket_transfer_data(request):
+ payload1 = 'Invalid continuation frame to be ignored.'
+ payload2 = 'Valid frame after closing should be disposed.'
+ request.connection.write(stream.create_header(common.OPCODE_CONTINUATION,
+ len(payload1),
+ 1, 0, 0, 0, 0) + payload1)
+ request.connection.write(stream.create_header(common.OPCODE_TEXT,
+ len(payload2),
+ 1, 0, 0, 0, 0) + payload2)
Modified: trunk/Source/WebCore/ChangeLog (92259 => 92260)
--- trunk/Source/WebCore/ChangeLog 2011-08-03 04:26:52 UTC (rev 92259)
+++ trunk/Source/WebCore/ChangeLog 2011-08-03 04:37:51 UTC (rev 92260)
@@ -1,3 +1,16 @@
+2011-08-02 Takashi Toyoshima <[email protected]>
+
+ WebSocket: Should be closed by receiving invalid continuation frame.
+
+ https://bugs.webkit.org/show_bug.cgi?id=65527
+
+ Reviewed by Kent Tamura.
+
+ Test: http/tests/websocket/tests/hybi/invalid-continuation.html
+
+ * websockets/WebSocketChannel.cpp:
+ (WebCore::WebSocketChannel::processFrame):
+
2011-08-02 Sheriff Bot <[email protected]>
Unreviewed, rolling out r92256.
Modified: trunk/Source/WebCore/websockets/WebSocketChannel.cpp (92259 => 92260)
--- trunk/Source/WebCore/websockets/WebSocketChannel.cpp 2011-08-03 04:26:52 UTC (rev 92259)
+++ trunk/Source/WebCore/websockets/WebSocketChannel.cpp 2011-08-03 04:37:51 UTC (rev 92260)
@@ -542,6 +542,11 @@
switch (frame.opCode) {
case OpCodeContinuation:
+ // An unexpected continuation frame is received without any leading frame.
+ if (!m_hasContinuousFrame) {
+ fail("Received unexpected continuation frame.");
+ return false;
+ }
// Throw away content of a binary message because binary messages are not supported yet.
if (m_continuousFrameOpCode == OpCodeText)
m_continuousFrameData.append(frame.payload, frame.payloadLength);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes