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 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 | 1686 |
1687 Future<HttpClientRequest> patch(String host, int port, String path) | 1687 Future<HttpClientRequest> patch(String host, int port, String path) |
1688 => open("patch", host, port, path); | 1688 => open("patch", host, port, path); |
1689 | 1689 |
1690 Future<HttpClientRequest> patchUrl(Uri url) => _openUrl("patch", url); | 1690 Future<HttpClientRequest> patchUrl(Uri url) => _openUrl("patch", url); |
1691 | 1691 |
1692 void close({bool force: false}) { | 1692 void close({bool force: false}) { |
1693 _closing = true; | 1693 _closing = true; |
1694 _connectionTargets.values.toList().forEach((c) => c.close(force)); | 1694 _connectionTargets.values.toList().forEach((c) => c.close(force)); |
1695 assert(!_connectionTargets.values.any((s) => s.hasIdle)); | 1695 assert(!_connectionTargets.values.any((s) => s.hasIdle)); |
1696 assert(!force || _connectionTargets.isEmpty); | 1696 assert(!force || |
| 1697 !_connectionTargets.values.any((s) => s._active.isNotEmpty)); |
1697 } | 1698 } |
1698 | 1699 |
1699 set authenticate(Future<bool> f(Uri url, String scheme, String realm)) { | 1700 set authenticate(Future<bool> f(Uri url, String scheme, String realm)) { |
1700 _authenticate = f; | 1701 _authenticate = f; |
1701 } | 1702 } |
1702 | 1703 |
1703 void addCredentials(Uri url, String realm, HttpClientCredentials cr) => | 1704 void addCredentials(Uri url, String realm, HttpClientCredentials cr) => |
1704 _credentials.add(new _SiteCredentials(url, realm, cr)); | 1705 _credentials.add(new _SiteCredentials(url, realm, cr)); |
1705 | 1706 |
1706 set authenticateProxy( | 1707 set authenticateProxy( |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2728 const _RedirectInfo(this.statusCode, this.method, this.location); | 2729 const _RedirectInfo(this.statusCode, this.method, this.location); |
2729 } | 2730 } |
2730 | 2731 |
2731 String _getHttpVersion() { | 2732 String _getHttpVersion() { |
2732 var version = Platform.version; | 2733 var version = Platform.version; |
2733 // Only include major and minor version numbers. | 2734 // Only include major and minor version numbers. |
2734 int index = version.indexOf('.', version.indexOf('.') + 1); | 2735 int index = version.indexOf('.', version.indexOf('.') + 1); |
2735 version = version.substring(0, index); | 2736 version = version.substring(0, index); |
2736 return 'Dart/$version (dart:io)'; | 2737 return 'Dart/$version (dart:io)'; |
2737 } | 2738 } |
OLD | NEW |