Chromium Code Reviews| 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 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1404 .then((info) { | 1404 .then((info) { |
| 1405 return info.connection.send(uri, | 1405 return info.connection.send(uri, |
| 1406 port, | 1406 port, |
| 1407 method.toUpperCase(), | 1407 method.toUpperCase(), |
| 1408 info.proxy); | 1408 info.proxy); |
| 1409 }); | 1409 }); |
| 1410 } | 1410 } |
| 1411 | 1411 |
| 1412 Future<HttpClientRequest> _openUrlFromRequest(String method, | 1412 Future<HttpClientRequest> _openUrlFromRequest(String method, |
| 1413 Uri uri, | 1413 Uri uri, |
| 1414 _HttpClientRequest previous) { | 1414 _HttpClientRequest previous) { |
|
Søren Gjesse
2013/05/06 13:26:11
Remove the first URI in the sentence.
Anders Johnsen
2013/05/06 13:59:04
Done.
| |
| 1415 // If the URI new URI is relative (to either '/' or some sub-path), | |
| 1416 // construct a full URI from the previous one. | |
| 1417 // See http://tools.ietf.org/html/rfc3986#section-4.2 | |
| 1418 replaceComponents({scheme, domain, port, path}) { | |
| 1419 uri = new Uri.fromComponents( | |
| 1420 scheme: scheme != null ? scheme : uri.scheme, | |
| 1421 domain: domain != null ? domain : uri.domain, | |
| 1422 port: port != null ? port : uri.port, | |
| 1423 path: path != null ? path : uri.path, | |
| 1424 query: uri.query, | |
| 1425 fragment: uri.fragment); | |
| 1426 } | |
| 1427 if (uri.domain == '') { | |
|
Søren Gjesse
2013/05/06 13:26:11
Can scheme be non empty here?
Anders Johnsen
2013/05/06 13:59:04
Done.
| |
| 1428 replaceComponents(domain: previous.uri.domain, port: previous.uri.port); | |
| 1429 } | |
| 1430 if (uri.scheme == '') { | |
| 1431 replaceComponents(scheme: previous.uri.scheme); | |
| 1432 } | |
| 1433 if (!uri.path.startsWith('/') && previous.uri.path.startsWith('/')) { | |
| 1434 var absolute = new Path.raw(previous.uri.path).directoryPath; | |
| 1435 absolute = absolute.join(new Path.raw(uri.path)); | |
| 1436 replaceComponents(path: absolute.canonicalize().toString()); | |
| 1437 } | |
| 1415 return openUrl(method, uri).then((_HttpClientRequest request) { | 1438 return openUrl(method, uri).then((_HttpClientRequest request) { |
| 1416 // Only follow redirects if initial request did. | 1439 // Only follow redirects if initial request did. |
| 1417 request.followRedirects = previous.followRedirects; | 1440 request.followRedirects = previous.followRedirects; |
| 1418 // Allow same number of redirects. | 1441 // Allow same number of redirects. |
| 1419 request.maxRedirects = previous.maxRedirects; | 1442 request.maxRedirects = previous.maxRedirects; |
| 1420 // Copy headers. | 1443 // Copy headers. |
| 1421 for (var header in previous.headers._headers.keys) { | 1444 for (var header in previous.headers._headers.keys) { |
| 1422 if (request.headers[header] == null) { | 1445 if (request.headers[header] == null) { |
| 1423 request.headers.set(header, previous.headers[header]); | 1446 request.headers.set(header, previous.headers[header]); |
| 1424 } | 1447 } |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2178 | 2201 |
| 2179 | 2202 |
| 2180 class _RedirectInfo implements RedirectInfo { | 2203 class _RedirectInfo implements RedirectInfo { |
| 2181 const _RedirectInfo(int this.statusCode, | 2204 const _RedirectInfo(int this.statusCode, |
| 2182 String this.method, | 2205 String this.method, |
| 2183 Uri this.location); | 2206 Uri this.location); |
| 2184 final int statusCode; | 2207 final int statusCode; |
| 2185 final String method; | 2208 final String method; |
| 2186 final Uri location; | 2209 final Uri location; |
| 2187 } | 2210 } |
| OLD | NEW |