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

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

Issue 12334010: Fix dart2js analyze _api_test for dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_headers.dart
diff --git a/sdk/lib/io/http_headers.dart b/sdk/lib/io/http_headers.dart
index 38da14975dc3d250a9ffb9a2026f4ee06bf00173..949ace316161dc97b89212315e5cf1ff300eb467 100644
--- a/sdk/lib/io/http_headers.dart
+++ b/sdk/lib/io/http_headers.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -247,27 +247,31 @@ class _HttpHeaders implements HttpHeaders {
throw new HttpException("Unexpected type for header named $name");
}
} else if (lowerCaseName == "host") {
- int pos = value.indexOf(":");
- if (pos == -1) {
- _host = value;
- _port = HttpClient.DEFAULT_HTTP_PORT;
- } else {
- if (pos > 0) {
- _host = value.substring(0, pos);
- } else {
- _host = null;
- }
- if (pos + 1 == value.length) {
+ if (value is String) {
+ int pos = (value as String).indexOf(":");
+ if (pos == -1) {
+ _host = value;
_port = HttpClient.DEFAULT_HTTP_PORT;
} else {
- try {
- _port = int.parse(value.substring(pos + 1));
- } on FormatException catch (e) {
- _port = null;
+ if (pos > 0) {
+ _host = (value as String).substring(0, pos);
+ } else {
+ _host = null;
+ }
+ if (pos + 1 == value.length) {
+ _port = HttpClient.DEFAULT_HTTP_PORT;
+ } else {
+ try {
+ _port = int.parse(value.substring(pos + 1));
+ } on FormatException catch (e) {
+ _port = null;
+ }
}
}
+ _set("host", value);
+ } else {
+ throw new HttpException("Unexpected type for header named $name");
}
- _set("host", value);
} else if (lowerCaseName == "content-type") {
_set("content-type", value);
} else {
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698