Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: sdk/lib/io/http_impl.dart

Issue 25426007: dart:io | Replace duplicate implementation with Uri.resolveUri in HttpClient. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index fcaf191978a2e9d573269c189b15e72a8bed21f6..99a9510cd582dacbcd49c8da4568713a6de3d6c0 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -1568,38 +1568,10 @@ class _HttpClient implements HttpClient {
Future<HttpClientRequest> _openUrlFromRequest(String method,
Uri uri,
_HttpClientRequest previous) {
- var u = uri;
// If the new URI is relative (to either '/' or some sub-path),
// construct a full URI from the previous one.
- // See http://tools.ietf.org/html/rfc3986#section-4.2
- replaceComponents({scheme, host, port, path}) {
- uri = new Uri(
- scheme: scheme != null ? scheme : uri.scheme,
- host: host != null ? host : uri.host,
- port: port != null ? port : uri.port,
- path: path != null ? path : uri.path,
- query: uri.query,
- fragment: uri.fragment);
- }
-
- var scheme;
- var host;
- var port;
- var path;
- if (uri.host.isEmpty) {
- host = previous.uri.host;
- port = previous.uri.port;
- }
- if (uri.scheme.isEmpty) {
- scheme = previous.uri.scheme;
- }
- if (!uri.path.startsWith('/')) {
- var absolute = new _Path.raw(previous.uri.path).directoryPath;
- absolute = absolute.join(new _Path.raw(u.path));
- path = absolute.canonicalize().toString();
- }
- replaceComponents(scheme: scheme, host: host, port: port, path: path);
- return openUrl(method, uri).then((_HttpClientRequest request) {
+ URI resolved = previous.uri.resolveUri(uri);
+ return openUrl(method, resolved).then((_HttpClientRequest request) {
// Only follow redirects if initial request did.
request.followRedirects = previous.followRedirects;
// Allow same number of redirects.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698