Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: sdk/lib/io/websocket_impl.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/process.dart ('k') | sdk/lib/isolate/base.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/websocket_impl.dart
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index bcd44f0332a7b3ea190b4abed4d17a673262ed69..c660740f0f7543b25769d409d9e1e9c70705919d 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -379,7 +379,7 @@ class _WebSocketConnectionBase {
}
_socket.onData = () {
int available = _socket.available();
- List<int> data = new List<int>(available);
+ List<int> data = new List<int>.fixedLength(available);
int read = _socket.readList(data, 0, available);
processor.update(data, 0, read);
};
@@ -536,7 +536,7 @@ class _WebSocketConnectionBase {
} else if (dataLength > 125) {
headerSize += 2;
}
- List<int> header = new List<int>(headerSize);
+ List<int> header = new List<int>.fixedLength(headerSize);
int index = 0;
// Set FIN and opcode.
header[index++] = 0x80 | opcode;
@@ -601,8 +601,8 @@ class _WebSocketHandler implements WebSocketHandler {
response.headers.add(HttpHeaders.UPGRADE, "websocket");
String key = request.headers.value("Sec-WebSocket-Key");
SHA1 sha1 = new SHA1();
- sha1.update("$key$_webSocketGUID".charCodes);
- String accept = _Base64._encode(sha1.digest());
+ sha1.add("$key$_webSocketGUID".charCodes);
+ String accept = _Base64._encode(sha1.close());
response.headers.add("Sec-WebSocket-Accept", accept);
response.contentLength = 0;
@@ -722,7 +722,7 @@ class _WebSocketClientConnection
}
// Generate 16 random bytes. Use the last four bytes for the hash code.
- List<int> nonce = new List<int>(16);
+ List<int> nonce = new List<int>.fixedLength(16);
for (int i = 0; i < 4; i++) {
int r = random.nextInt(0x100000000);
intToBigEndianBytes(r, nonce, i * 4);
@@ -749,8 +749,8 @@ class _WebSocketClientConnection
return false;
}
SHA1 sha1 = new SHA1();
- sha1.update("$_nonce$_webSocketGUID".charCodes);
- List<int> expectedAccept = sha1.digest();
+ sha1.add("$_nonce$_webSocketGUID".charCodes);
+ List<int> expectedAccept = sha1.close();
List<int> receivedAccept = _Base64._decode(accept);
if (expectedAccept.length != receivedAccept.length) return false;
for (int i = 0; i < expectedAccept.length; i++) {
« no previous file with comments | « sdk/lib/io/process.dart ('k') | sdk/lib/isolate/base.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698