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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1667 String host, | 1667 String host, |
1668 int port)) { | 1668 int port)) { |
1669 _badCertificateCallback = callback; | 1669 _badCertificateCallback = callback; |
1670 } | 1670 } |
1671 | 1671 |
1672 | 1672 |
1673 Future<HttpClientRequest> open(String method, | 1673 Future<HttpClientRequest> open(String method, |
1674 String host, | 1674 String host, |
1675 int port, | 1675 int port, |
1676 String path) { | 1676 String path) { |
| 1677 Uri uri = new Uri(scheme: "http", host: host, port: port).resolve(path); |
1677 // TODO(sgjesse): The path set here can contain both query and | 1678 // TODO(sgjesse): The path set here can contain both query and |
1678 // fragment. They should be cracked and set correctly. | 1679 // fragment. They should be cracked and set correctly. |
1679 return _openUrl(method, new Uri( | 1680 return _openUrl(method, uri); |
1680 scheme: "http", host: host, port: port, path: path)); | |
1681 } | 1681 } |
1682 | 1682 |
1683 Future<HttpClientRequest> openUrl(String method, Uri url) { | 1683 Future<HttpClientRequest> openUrl(String method, Uri url) { |
1684 return _openUrl(method, url); | 1684 return _openUrl(method, url); |
1685 } | 1685 } |
1686 | 1686 |
1687 Future<HttpClientRequest> get(String host, int port, String path) | 1687 Future<HttpClientRequest> get(String host, int port, String path) |
1688 => open("get", host, port, path); | 1688 => open("get", host, port, path); |
1689 | 1689 |
1690 Future<HttpClientRequest> getUrl(Uri url) => _openUrl("get", url); | 1690 Future<HttpClientRequest> getUrl(Uri url) => _openUrl("get", url); |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2798 const _RedirectInfo(this.statusCode, this.method, this.location); | 2798 const _RedirectInfo(this.statusCode, this.method, this.location); |
2799 } | 2799 } |
2800 | 2800 |
2801 String _getHttpVersion() { | 2801 String _getHttpVersion() { |
2802 var version = Platform.version; | 2802 var version = Platform.version; |
2803 // Only include major and minor version numbers. | 2803 // Only include major and minor version numbers. |
2804 int index = version.indexOf('.', version.indexOf('.') + 1); | 2804 int index = version.indexOf('.', version.indexOf('.') + 1); |
2805 version = version.substring(0, index); | 2805 version = version.substring(0, index); |
2806 return 'Dart/$version (dart:io)'; | 2806 return 'Dart/$version (dart:io)'; |
2807 } | 2807 } |
OLD | NEW |