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

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

Issue 1904553006: Fix strong mode errors in dart:io. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comment.~ Created 4 years, 7 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
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 Completer _closeCompleter = new Completer(); // The network socket is gone. 408 Completer _closeCompleter = new Completer(); // The network socket is gone.
409 _FilterStatus _filterStatus = new _FilterStatus(); 409 _FilterStatus _filterStatus = new _FilterStatus();
410 bool _connectPending = true; 410 bool _connectPending = true;
411 bool _filterPending = false; 411 bool _filterPending = false;
412 bool _filterActive = false; 412 bool _filterActive = false;
413 413
414 _SecureFilter _secureFilter = new _SecureFilter(); 414 _SecureFilter _secureFilter = new _SecureFilter();
415 String _selectedProtocol; 415 String _selectedProtocol;
416 416
417 static Future<_RawSecureSocket> connect( 417 static Future<_RawSecureSocket> connect(
418 host, 418 dynamic/*String|InternetAddress*/ host,
419 int requestedPort, 419 int requestedPort,
420 {bool is_server, 420 {bool is_server,
421 SecurityContext context, 421 SecurityContext context,
422 RawSocket socket, 422 RawSocket socket,
423 StreamSubscription subscription, 423 StreamSubscription subscription,
424 List<int> bufferedData, 424 List<int> bufferedData,
425 bool requestClientCertificate: false, 425 bool requestClientCertificate: false,
426 bool requireClientCertificate: false, 426 bool requireClientCertificate: false,
427 bool onBadCertificate(X509Certificate certificate), 427 bool onBadCertificate(X509Certificate certificate),
428 List<String> supportedProtocols}) { 428 List<String> supportedProtocols}) {
429 _verifyFields(host, requestedPort, is_server, 429 _verifyFields(host, requestedPort, is_server,
430 requestClientCertificate, requireClientCertificate, 430 requestClientCertificate, requireClientCertificate,
431 onBadCertificate); 431 onBadCertificate);
432 if (host is InternetAddress) host = host.host; 432 if (host is InternetAddress) host = host.host;
433 var address = socket.address; 433 InternetAddress address = socket.address;
434 if (host != null) address = address._cloneWithNewHost(host); 434 if (host != null) {
435 address = InternetAddress._cloneWithNewHost(address, host);
436 }
435 return new _RawSecureSocket(address, 437 return new _RawSecureSocket(address,
436 requestedPort, 438 requestedPort,
437 is_server, 439 is_server,
438 context, 440 context,
439 socket, 441 socket,
440 subscription, 442 subscription,
441 bufferedData, 443 bufferedData,
442 requestClientCertificate, 444 requestClientCertificate,
443 requireClientCertificate, 445 requireClientCertificate,
444 onBadCertificate, 446 onBadCertificate,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 requestClientCertificate || 512 requestClientCertificate ||
511 requireClientCertificate, 513 requireClientCertificate,
512 requireClientCertificate, 514 requireClientCertificate,
513 encodedProtocols); 515 encodedProtocols);
514 _secureHandshake(); 516 _secureHandshake();
515 } catch (e, s) { 517 } catch (e, s) {
516 _reportError(e, s); 518 _reportError(e, s);
517 } 519 }
518 } 520 }
519 521
520 StreamSubscription listen(void onData(RawSocketEvent data), 522 StreamSubscription<RawSocketEvent> listen(void onData(RawSocketEvent data),
521 {Function onError, 523 {Function onError,
522 void onDone(), 524 void onDone(),
523 bool cancelOnError}) { 525 bool cancelOnError}) {
524 _sendWriteEvent(); 526 _sendWriteEvent();
525 return _stream.listen(onData, 527 return _stream.listen(onData,
526 onError: onError, 528 onError: onError,
527 onDone: onDone, 529 onDone: onDone,
528 cancelOnError: cancelOnError); 530 cancelOnError: cancelOnError);
529 } 531 }
530 532
531 static void _verifyFields(host, 533 static void _verifyFields(host,
532 int requestedPort, 534 int requestedPort,
533 bool is_server, 535 bool is_server,
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 /** 1254 /**
1253 * An exception that happens in the handshake phase of establishing 1255 * An exception that happens in the handshake phase of establishing
1254 * a secure network connection, when looking up or verifying a 1256 * a secure network connection, when looking up or verifying a
1255 * certificate. 1257 * certificate.
1256 */ 1258 */
1257 class CertificateException extends TlsException { 1259 class CertificateException extends TlsException {
1258 const CertificateException([String message = "", 1260 const CertificateException([String message = "",
1259 OSError osError = null]) 1261 OSError osError = null])
1260 : super._("CertificateException", message, osError); 1262 : super._("CertificateException", message, osError);
1261 } 1263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698