summaryrefslogtreecommitdiffstats
path: root/net/data
diff options
context:
space:
mode:
authortoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-25 07:52:55 +0000
committertoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-25 07:52:55 +0000
commit32cbd36a062f9b40176dcb848537f60fd3fabce5 (patch)
tree60cdba5bb613877f4c6351f306d2043c8a4c63d2 /net/data
parentb03766fafc23b0777826747dabdfd17d41bd36bf (diff)
downloadchromium_src-32cbd36a062f9b40176dcb848537f60fd3fabce5.zip
chromium_src-32cbd36a062f9b40176dcb848537f60fd3fabce5.tar.gz
chromium_src-32cbd36a062f9b40176dcb848537f60fd3fabce5.tar.bz2
SSLClientSocket::IsConnected should care for internal buffers
SSLClientSocket::IsConnected() and SSLClientSocket::IsConnectedAndIdle() may return false though it has buffered data. They should care for internally processing buffer. There are various implementation, for NSS, OpenSSL, and platform dependent system libraries. This CL fix the issue on NSS. Fix for others will follow. BUG=160033 TEST=browser_tests, net_unittests Review URL: https://codereview.chromium.org/11366155 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178775 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/data')
-rw-r--r--net/data/websocket/README13
-rw-r--r--net/data/websocket/close-with-split-packet_wsh.py30
-rw-r--r--net/data/websocket/split_packet_check.html37
3 files changed, 80 insertions, 0 deletions
diff --git a/net/data/websocket/README b/net/data/websocket/README
index 034a30d..9dab697 100644
--- a/net/data/websocket/README
+++ b/net/data/websocket/README
@@ -7,6 +7,13 @@ Multiple tests may share one resource, or URI handler.
SSLUITest.TestWSSInvalidCertAndGoForward, SSLUITest.TestWSSClientCert,
and SSLUITestIgnoreCertErrors.TestWSS.
+- split_packet_check.html : A page for testing split packet handling. Here,
+ packets mean TCP segments for WebSocket, or SSL records for secure
+ WebSocket. This page changes the title to "PASS" to notify
+ content::TitleWatcher.
+ Used by WebSocketBrowserTest.WebSocketSplitSegments and
+ WebSocketBrowserTest.SecureWebSocketSplitRecords.
+
- websocket_shared_worker.html : A page provides simple WebSocket test in
shared worker. This page changes page title to "PASS" to notify
content::TitleWatcher.
@@ -31,6 +38,12 @@ Multiple tests may share one resource, or URI handler.
connection with arbitrary code and reason.
Used by kinds of PPAPI tests for WebSocket.
+- close-with-split-packet_wsh.py : A WebSocket URL handler for testing split
+ packet handling. Here, packets mean TCP segments for WebSocket, or SSL
+ records for secure WebSocket.
+ Used by WebSocketBrowserTest.WebSocketSplitSegments and
+ WebSocketBrowserTest.SecureWebSocketSplitRecords.
+
- protocol-test_wsh.py : A WebSocket URL handler for testing outgoing opening
handshake protocol.
Used by kinds of PPAPI tests for WebSocket.
diff --git a/net/data/websocket/close-with-split-packet_wsh.py b/net/data/websocket/close-with-split-packet_wsh.py
new file mode 100644
index 0000000..d5185c4
--- /dev/null
+++ b/net/data/websocket/close-with-split-packet_wsh.py
@@ -0,0 +1,30 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import struct
+
+from mod_pywebsocket import handshake
+from mod_pywebsocket import stream
+
+
+def web_socket_do_extra_handshake(_request):
+ pass
+
+
+def web_socket_transfer_data(request):
+ line = request.ws_stream.receive_message()
+ if line is None:
+ return
+ if isinstance(line, unicode):
+ request.ws_stream.send_message(line, binary=False)
+ else:
+ request.ws_stream.send_message(line, binary=True)
+
+
+def web_socket_passive_closing_handshake(request):
+ code = struct.pack('!H', 1000)
+ packet = stream.create_close_frame(code + 'split test'.encode('utf-8'))
+ request.connection.write(packet[:1])
+ request.connection.write(packet[1:])
+ raise handshake.AbortedByUserException('Abort the connection')
diff --git a/net/data/websocket/split_packet_check.html b/net/data/websocket/split_packet_check.html
new file mode 100644
index 0000000..8e273ec
--- /dev/null
+++ b/net/data/websocket/split_packet_check.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>test ws split packet</title>
+<script type="text/javascript">
+
+var href = window.location.href;
+var hostBegin = href.indexOf('/') + 2;
+var hostEnd = href.lastIndexOf(':');
+var host = href.slice(hostBegin, hostEnd);
+var portBegin = hostEnd + 1;
+var portEnd = href.lastIndexOf('/');
+var port = href.slice(portBegin, portEnd);
+var scheme = href.indexOf('https') >= 0 ? 'wss' : 'ws';
+var url = scheme + '://' + host + ':' + port + '/close-with-split-packet';
+
+// Do connection test.
+var ws = new WebSocket(url);
+
+ws.onopen = function()
+{
+ // Close WebSocket connection once it is established.
+ ws.close();
+}
+
+ws.onclose = function(event)
+{
+ // Check wasClean, then set proper title.
+ if (event.wasClean)
+ document.title = 'PASS';
+ else
+ document.title = 'FAIL';
+}
+
+</script>
+</head>
+</html>