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

Unified Diff: src/url_canon_stdurl.cc

Issue 149588: Require hosts for non-file URLs. (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: '' Created 11 years, 5 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 | src/url_canon_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/url_canon_stdurl.cc
===================================================================
--- src/url_canon_stdurl.cc (revision 107)
+++ src/url_canon_stdurl.cc (working copy)
@@ -66,10 +66,13 @@
&new_parsed->username,
&new_parsed->password);
- // Host: always write if we have an authority (may be empty).
success &= CanonicalizeHost(source.host, parsed.host,
output, &new_parsed->host);
+ // Host must not be empty for standard URLs.
+ if (!parsed.host.is_nonempty())
+ success = false;
+
// Port: the port canonicalizer will handle the colon.
int default_port = DefaultPortForScheme(
&output->data()[new_parsed->scheme.begin], new_parsed->scheme.len);
« no previous file with comments | « no previous file | src/url_canon_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698