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 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 } | 1563 } |
1564 return send(info); | 1564 return send(info); |
1565 }); | 1565 }); |
1566 } | 1566 } |
1567 | 1567 |
1568 Future<HttpClientRequest> _openUrlFromRequest(String method, | 1568 Future<HttpClientRequest> _openUrlFromRequest(String method, |
1569 Uri uri, | 1569 Uri uri, |
1570 _HttpClientRequest previous) { | 1570 _HttpClientRequest previous) { |
1571 // If the new URI is relative (to either '/' or some sub-path), | 1571 // If the new URI is relative (to either '/' or some sub-path), |
1572 // construct a full URI from the previous one. | 1572 // construct a full URI from the previous one. |
1573 URI resolved = previous.uri.resolveUri(uri); | 1573 Uri resolved = previous.uri.resolveUri(uri); |
1574 return openUrl(method, resolved).then((_HttpClientRequest request) { | 1574 return openUrl(method, resolved).then((_HttpClientRequest request) { |
1575 // Only follow redirects if initial request did. | 1575 // Only follow redirects if initial request did. |
1576 request.followRedirects = previous.followRedirects; | 1576 request.followRedirects = previous.followRedirects; |
1577 // Allow same number of redirects. | 1577 // Allow same number of redirects. |
1578 request.maxRedirects = previous.maxRedirects; | 1578 request.maxRedirects = previous.maxRedirects; |
1579 // Copy headers. | 1579 // Copy headers. |
1580 for (var header in previous.headers._headers.keys) { | 1580 for (var header in previous.headers._headers.keys) { |
1581 if (request.headers[header] == null) { | 1581 if (request.headers[header] == null) { |
1582 request.headers.set(header, previous.headers[header]); | 1582 request.headers.set(header, previous.headers[header]); |
1583 } | 1583 } |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2447 final Uri location; | 2447 final Uri location; |
2448 } | 2448 } |
2449 | 2449 |
2450 String _getHttpVersion() { | 2450 String _getHttpVersion() { |
2451 var version = Platform.version; | 2451 var version = Platform.version; |
2452 // Only include major and minor version numbers. | 2452 // Only include major and minor version numbers. |
2453 int index = version.indexOf('.', version.indexOf('.') + 1); | 2453 int index = version.indexOf('.', version.indexOf('.') + 1); |
2454 version = version.substring(0, index); | 2454 version = version.substring(0, index); |
2455 return 'Dart/$version (dart:io)'; | 2455 return 'Dart/$version (dart:io)'; |
2456 } | 2456 } |
OLD | NEW |