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

Side by Side Diff: url/url_canon.h

Issue 2456643005: Reduce buggy usage of the registry controlled domain service. (Closed)
Patch Set: Fix Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « net/cert/x509_certificate.cc ('k') | url/url_canon_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef URL_URL_CANON_H_ 5 #ifndef URL_URL_CANON_H_
6 #define URL_URL_CANON_H_ 6 #define URL_URL_CANON_H_
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // definition of CanonHostInfo above for details. 372 // definition of CanonHostInfo above for details.
373 URL_EXPORT void CanonicalizeHostVerbose(const char* spec, 373 URL_EXPORT void CanonicalizeHostVerbose(const char* spec,
374 const Component& host, 374 const Component& host,
375 CanonOutput* output, 375 CanonOutput* output,
376 CanonHostInfo* host_info); 376 CanonHostInfo* host_info);
377 URL_EXPORT void CanonicalizeHostVerbose(const base::char16* spec, 377 URL_EXPORT void CanonicalizeHostVerbose(const base::char16* spec,
378 const Component& host, 378 const Component& host,
379 CanonOutput* output, 379 CanonOutput* output,
380 CanonHostInfo* host_info); 380 CanonHostInfo* host_info);
381 381
382 // Canonicalizes a string according to the host canonicalization rules. Unlike
383 // CanonicalizeHost, this will not check for IP addresses which can change the
384 // meaning (and canonicalization) of the components. This means it is possible
385 // to call this for sub-components of a host name without corruption.
386 //
387 // As an example, "01.02.03.04.com" is a canonical hostname. If you called
388 // CanonicalizeHost on the substring "01.02.03.04" it will get "fixed" to
389 // "1.2.3.4" which will produce an invalid host name when reassembled. This
390 // can happen more than one might think because all numbers by themselves are
391 // considered IP addresses; so "5" canonicalizes to "0.0.0.5".
392 //
393 // Be careful: Because Punycode works on each dot-separated substring as a
394 // unit, you should only pass this function substrings that represent complete
395 // dot-separated subcomponents of the original host. Even if you have ASCII
396 // input, percent-escaped characters will have different meanings if split in
397 // the middle.
398 //
399 // Returns true if the host was valid. This function will treat a 0-length
400 // host as valid (because it's designed to be used for substrings) while the
401 // full version above will mark empty hosts as broken.
402 URL_EXPORT bool CanonicalizeHostSubstring(const char* spec,
403 const Component& host,
404 CanonOutput* output);
405 URL_EXPORT bool CanonicalizeHostSubstring(const base::char16* spec,
406 const Component& host,
407 CanonOutput* output);
408
382 // IP addresses. 409 // IP addresses.
383 // 410 //
384 // Tries to interpret the given host name as an IPv4 or IPv6 address. If it is 411 // Tries to interpret the given host name as an IPv4 or IPv6 address. If it is
385 // an IP address, it will canonicalize it as such, appending it to |output|. 412 // an IP address, it will canonicalize it as such, appending it to |output|.
386 // Additional status information is returned via the |*host_info| parameter. 413 // Additional status information is returned via the |*host_info| parameter.
387 // See the definition of CanonHostInfo above for details. 414 // See the definition of CanonHostInfo above for details.
388 // 415 //
389 // This is called AUTOMATICALLY from the host canonicalizer, which ensures that 416 // This is called AUTOMATICALLY from the host canonicalizer, which ensures that
390 // the input is unescaped and name-prepped, etc. It should not normally be 417 // the input is unescaped and name-prepped, etc. It should not normally be
391 // necessary or wise to call this directly. 418 // necessary or wise to call this directly.
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 bool base_is_file, 910 bool base_is_file,
884 const base::char16* relative_url, 911 const base::char16* relative_url,
885 const Component& relative_component, 912 const Component& relative_component,
886 CharsetConverter* query_converter, 913 CharsetConverter* query_converter,
887 CanonOutput* output, 914 CanonOutput* output,
888 Parsed* out_parsed); 915 Parsed* out_parsed);
889 916
890 } // namespace url 917 } // namespace url
891 918
892 #endif // URL_URL_CANON_H_ 919 #endif // URL_URL_CANON_H_
OLDNEW
« no previous file with comments | « net/cert/x509_certificate.cc ('k') | url/url_canon_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698