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

Side by Side Diff: url_canon_ip.h

Issue 2029803003: Update to Chromium //url at Chromium commit 79dc59ac7602413181079ecb463873e29a1d7d0a. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/domokit/gurl@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « url_canon_internal_file.h ('k') | url_canon_ip.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_IP_H_ 5 #ifndef URL_URL_CANON_IP_H_
6 #define URL_URL_CANON_IP_H_ 6 #define URL_URL_CANON_IP_H_
7 7
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "url/third_party/mozilla/url_parse.h"
9 #include "url/url_canon.h" 10 #include "url/url_canon.h"
10 #include "url/url_export.h" 11 #include "url/url_export.h"
11 #include "url/url_parse.h"
12 12
13 namespace url { 13 namespace url {
14 14
15 // Writes the given IPv4 address to |output|. 15 // Writes the given IPv4 address to |output|.
16 URL_EXPORT void AppendIPv4Address(const unsigned char address[4], 16 URL_EXPORT void AppendIPv4Address(const unsigned char address[4],
17 CanonOutput* output); 17 CanonOutput* output);
18 18
19 // Writes the given IPv6 address to |output|. 19 // Writes the given IPv6 address to |output|.
20 URL_EXPORT void AppendIPv6Address(const unsigned char address[16], 20 URL_EXPORT void AppendIPv6Address(const unsigned char address[16],
21 CanonOutput* output); 21 CanonOutput* output);
22 22
23 // Searches the host name for the portions of the IPv4 address. On success, 23 // Searches the host name for the portions of the IPv4 address. On success,
24 // each component will be placed into |components| and it will return true. 24 // each component will be placed into |components| and it will return true.
25 // It will return false if the host can not be separated as an IPv4 address 25 // It will return false if the host can not be separated as an IPv4 address
26 // or if there are any non-7-bit characters or other characters that can not 26 // or if there are any non-7-bit characters or other characters that can not
27 // be in an IP address. (This is important so we fail as early as possible for 27 // be in an IP address. (This is important so we fail as early as possible for
28 // common non-IP hostnames.) 28 // common non-IP hostnames.)
29 // 29 //
30 // Not all components may exist. If there are only 3 components, for example, 30 // Not all components may exist. If there are only 3 components, for example,
31 // the last one will have a length of -1 or 0 to indicate it does not exist. 31 // the last one will have a length of -1 or 0 to indicate it does not exist.
32 // 32 //
33 // Note that many platform's inet_addr will ignore everything after a space 33 // Note that many platforms' inet_addr will ignore everything after a space
34 // in certain curcumstances if the stuff before the space looks like an IP 34 // in certain circumstances if the stuff before the space looks like an IP
35 // address. IE6 is included in this. We do NOT handle this case. In many cases, 35 // address. IE6 is included in this. We do NOT handle this case. In many cases,
36 // the browser's canonicalization will get run before this which converts 36 // the browser's canonicalization will get run before this which converts
37 // spaces to %20 (in the case of IE7) or rejects them (in the case of 37 // spaces to %20 (in the case of IE7) or rejects them (in the case of Mozilla),
38 // Mozilla), so this code path never gets hit. Our host canonicalization will 38 // so this code path never gets hit. Our host canonicalization will notice
39 // notice these spaces and escape them, which will make IP address finding 39 // these spaces and escape them, which will make IP address finding fail. This
40 // fail. This seems like better behavior than stripping after a space. 40 // seems like better behavior than stripping after a space.
41 URL_EXPORT bool FindIPv4Components(const char* spec, 41 URL_EXPORT bool FindIPv4Components(const char* spec,
42 const Component& host, 42 const Component& host,
43 Component components[4]); 43 Component components[4]);
44 URL_EXPORT bool FindIPv4Components(const base::char16* spec, 44 URL_EXPORT bool FindIPv4Components(const base::char16* spec,
45 const Component& host, 45 const Component& host,
46 Component components[4]); 46 Component components[4]);
47 47
48 // Converts an IPv4 address to a 32-bit number (network byte order). 48 // Converts an IPv4 address to a 32-bit number (network byte order).
49 // 49 //
50 // Possible return values: 50 // Possible return values:
(...skipping 22 matching lines...) Expand all
73 URL_EXPORT bool IPv6AddressToNumber(const char* spec, 73 URL_EXPORT bool IPv6AddressToNumber(const char* spec,
74 const Component& host, 74 const Component& host,
75 unsigned char address[16]); 75 unsigned char address[16]);
76 URL_EXPORT bool IPv6AddressToNumber(const base::char16* spec, 76 URL_EXPORT bool IPv6AddressToNumber(const base::char16* spec,
77 const Component& host, 77 const Component& host,
78 unsigned char address[16]); 78 unsigned char address[16]);
79 79
80 } // namespace url 80 } // namespace url
81 81
82 #endif // URL_URL_CANON_IP_H_ 82 #endif // URL_URL_CANON_IP_H_
OLDNEW
« no previous file with comments | « url_canon_internal_file.h ('k') | url_canon_ip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698