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 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 var port; | 1583 var port; |
1584 var path; | 1584 var path; |
1585 if (uri.host.isEmpty) { | 1585 if (uri.host.isEmpty) { |
1586 host = previous.uri.host; | 1586 host = previous.uri.host; |
1587 port = previous.uri.port; | 1587 port = previous.uri.port; |
1588 } | 1588 } |
1589 if (uri.scheme.isEmpty) { | 1589 if (uri.scheme.isEmpty) { |
1590 scheme = previous.uri.scheme; | 1590 scheme = previous.uri.scheme; |
1591 } | 1591 } |
1592 if (!uri.path.startsWith('/')) { | 1592 if (!uri.path.startsWith('/')) { |
1593 var absolute = new Path.raw(previous.uri.path).directoryPath; | 1593 var absolute = new _Path.raw(previous.uri.path).directoryPath; |
1594 absolute = absolute.join(new Path.raw(u.path)); | 1594 absolute = absolute.join(new _Path.raw(u.path)); |
1595 path = absolute.canonicalize().toString(); | 1595 path = absolute.canonicalize().toString(); |
1596 } | 1596 } |
1597 replaceComponents(scheme: scheme, host: host, port: port, path: path); | 1597 replaceComponents(scheme: scheme, host: host, port: port, path: path); |
1598 return openUrl(method, uri).then((_HttpClientRequest request) { | 1598 return openUrl(method, uri).then((_HttpClientRequest request) { |
1599 // Only follow redirects if initial request did. | 1599 // Only follow redirects if initial request did. |
1600 request.followRedirects = previous.followRedirects; | 1600 request.followRedirects = previous.followRedirects; |
1601 // Allow same number of redirects. | 1601 // Allow same number of redirects. |
1602 request.maxRedirects = previous.maxRedirects; | 1602 request.maxRedirects = previous.maxRedirects; |
1603 // Copy headers. | 1603 // Copy headers. |
1604 for (var header in previous.headers._headers.keys) { | 1604 for (var header in previous.headers._headers.keys) { |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 final Uri location; | 2445 final Uri location; |
2446 } | 2446 } |
2447 | 2447 |
2448 String _getHttpVersion() { | 2448 String _getHttpVersion() { |
2449 var version = Platform.version; | 2449 var version = Platform.version; |
2450 // Only include major and minor version numbers. | 2450 // Only include major and minor version numbers. |
2451 int index = version.indexOf('.', version.indexOf('.') + 1); | 2451 int index = version.indexOf('.', version.indexOf('.') + 1); |
2452 version = version.substring(0, index); | 2452 version = version.substring(0, index); |
2453 return 'Dart/$version (dart:io)'; | 2453 return 'Dart/$version (dart:io)'; |
2454 } | 2454 } |
OLD | NEW |