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 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; | 7 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; |
8 | 8 |
9 class _HttpIncoming extends Stream<List<int>> { | 9 class _HttpIncoming extends Stream<List<int>> { |
10 final int _transferLength; | 10 final int _transferLength; |
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 Future<_ConnectionInfo> connect(error) { | 1876 Future<_ConnectionInfo> connect(error) { |
1877 if (!proxies.moveNext()) return new Future.error(error); | 1877 if (!proxies.moveNext()) return new Future.error(error); |
1878 _Proxy proxy = proxies.current; | 1878 _Proxy proxy = proxies.current; |
1879 String host = proxy.isDirect ? uriHost: proxy.host; | 1879 String host = proxy.isDirect ? uriHost: proxy.host; |
1880 int port = proxy.isDirect ? uriPort: proxy.port; | 1880 int port = proxy.isDirect ? uriPort: proxy.port; |
1881 return _getConnectionTarget(host, port, isSecure) | 1881 return _getConnectionTarget(host, port, isSecure) |
1882 .connect(uriHost, uriPort, proxy, this) | 1882 .connect(uriHost, uriPort, proxy, this) |
1883 // On error, continue with next proxy. | 1883 // On error, continue with next proxy. |
1884 .catchError(connect); | 1884 .catchError(connect); |
1885 } | 1885 } |
1886 return new Future(() => connect(new HttpException("No proxies given"))); | 1886 return connect(new HttpException("No proxies given")); |
1887 } | 1887 } |
1888 | 1888 |
1889 _SiteCredentials _findCredentials(Uri url, [_AuthenticationScheme scheme]) { | 1889 _SiteCredentials _findCredentials(Uri url, [_AuthenticationScheme scheme]) { |
1890 // Look for credentials. | 1890 // Look for credentials. |
1891 _SiteCredentials cr = | 1891 _SiteCredentials cr = |
1892 _credentials.fold(null, (prev, value) { | 1892 _credentials.fold(null, (prev, value) { |
1893 if (value.applies(url, scheme)) { | 1893 if (value.applies(url, scheme)) { |
1894 if (prev == null) return value; | 1894 if (prev == null) return value; |
1895 return value.uri.path.length > prev.uri.path.length ? value : prev; | 1895 return value.uri.path.length > prev.uri.path.length ? value : prev; |
1896 } else { | 1896 } else { |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 const _RedirectInfo(this.statusCode, this.method, this.location); | 2812 const _RedirectInfo(this.statusCode, this.method, this.location); |
2813 } | 2813 } |
2814 | 2814 |
2815 String _getHttpVersion() { | 2815 String _getHttpVersion() { |
2816 var version = Platform.version; | 2816 var version = Platform.version; |
2817 // Only include major and minor version numbers. | 2817 // Only include major and minor version numbers. |
2818 int index = version.indexOf('.', version.indexOf('.') + 1); | 2818 int index = version.indexOf('.', version.indexOf('.') + 1); |
2819 version = version.substring(0, index); | 2819 version = version.substring(0, index); |
2820 return 'Dart/$version (dart:io)'; | 2820 return 'Dart/$version (dart:io)'; |
2821 } | 2821 } |
OLD | NEW |