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

Side by Side Diff: sdk/lib/io/secure_socket.dart

Issue 12334035: Don't send null data events on a Socket stream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * A high-level class for communicating securely over a TCP socket, using 8 * A high-level class for communicating securely over a TCP socket, using
9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an 9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an
10 * [IOSink] interface, making it ideal for using together with 10 * [IOSink] interface, making it ideal for using together with
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 new Timer(0, (_) => _readHandler()); 404 new Timer(0, (_) => _readHandler());
405 } 405 }
406 } 406 }
407 } 407 }
408 408
409 List<int> read([int len]) { 409 List<int> read([int len]) {
410 if (_closedRead) { 410 if (_closedRead) {
411 throw new SocketIOException("Reading from a closed socket"); 411 throw new SocketIOException("Reading from a closed socket");
412 } 412 }
413 if (_status != CONNECTED) { 413 if (_status != CONNECTED) {
414 return new List<int>(0); 414 return null;
415 } 415 }
416 var buffer = _secureFilter.buffers[READ_PLAINTEXT]; 416 var buffer = _secureFilter.buffers[READ_PLAINTEXT];
417 _readEncryptedData(); 417 _readEncryptedData();
418 int toRead = buffer.length; 418 int toRead = buffer.length;
419 if (len != null) { 419 if (len != null) {
420 if (len is! int || len < 0) { 420 if (len is! int || len < 0) {
421 throw new ArgumentError( 421 throw new ArgumentError(
422 "Invalid len parameter in SecureSocket.read (len: $len)"); 422 "Invalid len parameter in SecureSocket.read (len: $len)");
423 } 423 }
424 if (len < toRead) { 424 if (len < toRead) {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 void destroy(); 738 void destroy();
739 void handshake(); 739 void handshake();
740 void init(); 740 void init();
741 X509Certificate get peerCertificate; 741 X509Certificate get peerCertificate;
742 int processBuffer(int bufferIndex); 742 int processBuffer(int bufferIndex);
743 void registerBadCertificateCallback(Function callback); 743 void registerBadCertificateCallback(Function callback);
744 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); 744 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler);
745 745
746 List<_ExternalBuffer> get buffers; 746 List<_ExternalBuffer> get buffers;
747 } 747 }
OLDNEW
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698