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

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

Issue 16019002: Merge the dart:uri library into dart:core and update the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to 23236 Created 7 years, 7 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
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 7e16e5fe4662e3a908d7faf1c39a9227a049bb89..bbff9e5a9fb8d51554c1974c031327859c648fd8 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -944,7 +944,7 @@ class _HttpClientRequest extends _HttpOutboundMessage<HttpClientResponse>
// For the connect method the request URI is the host:port of
// the requested destination of the tunnel (see RFC 2817
// section 5.2)
- return "${uri.domain}:${uri.port}";
+ return "${uri.host}:${uri.port}";
} else {
if (_httpClientConnection._proxyTunnel) {
return uriStartingFromPath();
@@ -1153,7 +1153,7 @@ class _HttpClientConnection {
proxy,
_httpClient,
this);
- request.headers.host = uri.domain;
+ request.headers.host = uri.host;
request.headers.port = port;
request.headers.set(HttpHeaders.ACCEPT_ENCODING, "gzip");
if (proxy.isAuthenticated) {
@@ -1276,7 +1276,7 @@ class _HttpClientConnection {
Future<_HttpClientConnection> createProxyTunnel(host, port, proxy) {
_HttpClientRequest request =
- send(new Uri.fromComponents(domain: host, port: port),
+ send(new Uri(host: host, port: port),
port,
"CONNECT",
proxy);
@@ -1369,8 +1369,8 @@ class _HttpClient implements HttpClient {
String path) {
// TODO(sgjesse): The path set here can contain both query and
// fragment. They should be cracked and set correctly.
- return _openUrl(method, new Uri.fromComponents(
- scheme: "http", domain: host, port: port, path: path));
+ return _openUrl(method, new Uri(
+ scheme: "http", host: host, port: port, path: path));
}
Future<HttpClientRequest> openUrl(String method, Uri url) {
@@ -1447,7 +1447,7 @@ class _HttpClient implements HttpClient {
throw new ArgumentError(method);
}
if (method != "CONNECT") {
- if (uri.domain.isEmpty ||
+ if (uri.host.isEmpty ||
(uri.scheme != "http" && uri.scheme != "https")) {
throw new ArgumentError("Unsupported scheme '${uri.scheme}' in $uri");
}
@@ -1471,7 +1471,7 @@ class _HttpClient implements HttpClient {
return new Future.error(error, stackTrace);
}
}
- return _getConnection(uri.domain, port, proxyConf, isSecure)
+ return _getConnection(uri.host, port, proxyConf, isSecure)
.then((info) {
send(info) {
return info.connection.send(uri,
@@ -1482,7 +1482,7 @@ class _HttpClient implements HttpClient {
// If the connection was closed before the request was sent, create
// and use another connection.
if (info.connection.closed) {
- return _getConnection(uri.domain, port, proxyConf, isSecure)
+ return _getConnection(uri.host, port, proxyConf, isSecure)
.then(send);
}
return send(info);
@@ -1495,19 +1495,19 @@ class _HttpClient implements HttpClient {
// 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, domain, port, path}) {
- uri = new Uri.fromComponents(
+ replaceComponents({scheme, host, port, path}) {
+ uri = new Uri(
scheme: scheme != null ? scheme : uri.scheme,
Lasse Reichstein Nielsen 2013/05/28 08:45:33 What if domain is "", will it break anything?
Søren Gjesse 2013/05/28 13:33:26 I don't think so - nothing changed here.
- domain: domain != null ? domain : uri.domain,
+ host: host != null ? host : uri.host,
port: port != null ? port : uri.port,
path: path != null ? path : uri.path,
query: uri.query,
fragment: uri.fragment);
}
- if (uri.domain == '') {
- replaceComponents(domain: previous.uri.domain, port: previous.uri.port);
+ if (uri.host.isEmpty) {
+ replaceComponents(host: previous.uri.host, port: previous.uri.port);
}
- if (uri.scheme == '') {
+ if (uri.scheme.isEmpty) {
replaceComponents(scheme: previous.uri.scheme);
}
if (!uri.path.startsWith('/') && previous.uri.path.startsWith('/')) {
@@ -1674,7 +1674,7 @@ class _HttpClient implements HttpClient {
if (option == null) return null;
Iterator<String> names = option.split(",").map((s) => s.trim()).iterator;
while (names.moveNext()) {
- if (url.domain.endsWith(names.current)) {
+ if (url.host.endsWith(names.current)) {
return "DIRECT";
}
}
@@ -2170,7 +2170,7 @@ class _SiteCredentials extends _Credentials {
bool applies(Uri uri, _AuthenticationScheme scheme) {
if (scheme != null && credentials.scheme != scheme) return false;
- if (uri.domain != this.uri.domain) return false;
+ if (uri.host != this.uri.host) return false;
int thisPort =
this.uri.port == 0 ? HttpClient.DEFAULT_HTTP_PORT : this.uri.port;
int otherPort = uri.port == 0 ? HttpClient.DEFAULT_HTTP_PORT : uri.port;
« sdk/lib/core/uri.dart ('K') | « sdk/lib/core/uri.dart ('k') | sdk/lib/io/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698