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

Unified Diff: sdk/lib/core/uri.dart

Issue 347393003: Fix bugs in Uri: Allow empty port, handle path starting with "//" in toString. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | tests/corelib/uri_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/uri.dart
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index 7f67a2d9261f1b821e1ed4239696d1ad067c27cd..73a97d80e1c3288aac66beca9735b5bf3d59c4c8 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -234,9 +234,6 @@ class Uri {
hostStart = lastAt + 1;
}
if (lastColon >= 0) {
- if (lastColon + 1 == index) {
- _fail(uri, index, "Invalid port number");
- }
int portNumber = 0;
for (int i = lastColon + 1; i < index; i++) {
int digit = uri.codeUnitAt(i);
@@ -1485,7 +1482,9 @@ class Uri {
String toString() {
StringBuffer sb = new StringBuffer();
_addIfNonEmpty(sb, scheme, scheme, ':');
- if (hasAuthority || (scheme == "file")) {
+ if (hasAuthority || path.startsWith("//") || (scheme == "file")) {
+ // File URIS always have the authority, even if it is empty.
+ // The empty URI means "localhost".
sb.write("//");
_writeAuthority(sb);
}
« no previous file with comments | « no previous file | tests/corelib/uri_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698