OLD | NEW |
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 class _HttpIncoming extends Stream<List<int>> { | 7 class _HttpIncoming extends Stream<List<int>> { |
8 final int _transferLength; | 8 final int _transferLength; |
9 final Completer _dataCompleter = new Completer(); | 9 final Completer _dataCompleter = new Completer(); |
10 Stream<List<int>> _stream; | 10 Stream<List<int>> _stream; |
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 } | 1712 } |
1713 connection.stopTimer(); | 1713 connection.stopTimer(); |
1714 _activeConnections.add(connection); | 1714 _activeConnections.add(connection); |
1715 _updateTimers(); | 1715 _updateTimers(); |
1716 return new Future.value(new _ConnnectionInfo(connection, proxy)); | 1716 return new Future.value(new _ConnnectionInfo(connection, proxy)); |
1717 } | 1717 } |
1718 var currentBadCertificateCallback = _badCertificateCallback; | 1718 var currentBadCertificateCallback = _badCertificateCallback; |
1719 bool callback(X509Certificate certificate) => | 1719 bool callback(X509Certificate certificate) => |
1720 currentBadCertificateCallback == null ? false : | 1720 currentBadCertificateCallback == null ? false : |
1721 currentBadCertificateCallback(certificate, uriHost, uriPort); | 1721 currentBadCertificateCallback(certificate, uriHost, uriPort); |
1722 return (isSecure && proxy.isDirect | 1722 Future socketFuture = (isSecure && proxy.isDirect |
1723 ? SecureSocket.connect(host, | 1723 ? SecureSocket.connect(host, |
1724 port, | 1724 port, |
1725 sendClientCertificate: true, | 1725 sendClientCertificate: true, |
1726 onBadCertificate: callback) | 1726 onBadCertificate: callback) |
1727 : Socket.connect(host, port)) | 1727 : Socket.connect(host, port)); |
1728 .then((socket) { | 1728 return socketFuture.then((socket) { |
1729 socket.setOption(SocketOption.TCP_NODELAY, true); | 1729 socket.setOption(SocketOption.TCP_NODELAY, true); |
1730 var connection = new _HttpClientConnection(key, socket, this); | 1730 var connection = new _HttpClientConnection(key, socket, this); |
1731 if (isSecure && !proxy.isDirect) { | 1731 if (isSecure && !proxy.isDirect) { |
1732 connection._dispose = true; | 1732 connection._dispose = true; |
1733 return connection.createProxyTunnel( | 1733 return connection.createProxyTunnel( |
1734 uriHost, uriPort, proxy, callback) | 1734 uriHost, uriPort, proxy, callback) |
1735 .then((tunnel) { | 1735 .then((tunnel) { |
1736 _activeConnections.add(tunnel); | 1736 _activeConnections.add(tunnel); |
1737 return new _ConnnectionInfo(tunnel, proxy); | 1737 return new _ConnnectionInfo(tunnel, proxy); |
1738 }); | 1738 }); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2521 final Uri location; | 2521 final Uri location; |
2522 } | 2522 } |
2523 | 2523 |
2524 String _getHttpVersion() { | 2524 String _getHttpVersion() { |
2525 var version = Platform.version; | 2525 var version = Platform.version; |
2526 // Only include major and minor version numbers. | 2526 // Only include major and minor version numbers. |
2527 int index = version.indexOf('.', version.indexOf('.') + 1); | 2527 int index = version.indexOf('.', version.indexOf('.') + 1); |
2528 version = version.substring(0, index); | 2528 version = version.substring(0, index); |
2529 return 'Dart/$version (dart:io)'; | 2529 return 'Dart/$version (dart:io)'; |
2530 } | 2530 } |
OLD | NEW |