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

Side by Side Diff: net/base/dns_util.cc

Issue 54623005: net: allow invalid TransportSecurityState to process invalid DNS names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser tests. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/base/dns_util.h ('k') | net/base/dns_util_unittest.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "net/base/dns_util.h" 5 #include "net/base/dns_util.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 namespace net { 9 namespace net {
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 ret += "."; 73 ret += ".";
74 74
75 if (static_cast<unsigned>(domain[i]) + i + 1 > domain.size()) 75 if (static_cast<unsigned>(domain[i]) + i + 1 > domain.size())
76 return std::string(); 76 return std::string();
77 77
78 domain.substr(i + 1, domain[i]).AppendToString(&ret); 78 domain.substr(i + 1, domain[i]).AppendToString(&ret);
79 } 79 }
80 return ret; 80 return ret;
81 } 81 }
82 82
83 bool IsSTD3ASCIIValidCharacter(char c) {
84 if (c <= 0x2c)
85 return false;
86 if (c >= 0x7b)
87 return false;
88 if (c >= 0x2e && c <= 0x2f)
89 return false;
90 if (c >= 0x3a && c <= 0x40)
91 return false;
92 if (c >= 0x5b && c <= 0x60)
93 return false;
94 return true;
95 }
96
97 std::string TrimEndingDot(const base::StringPiece& host) { 83 std::string TrimEndingDot(const base::StringPiece& host) {
98 base::StringPiece host_trimmed = host; 84 base::StringPiece host_trimmed = host;
99 size_t len = host_trimmed.length(); 85 size_t len = host_trimmed.length();
100 if (len > 1 && host_trimmed[len - 1] == '.') { 86 if (len > 1 && host_trimmed[len - 1] == '.') {
101 host_trimmed.remove_suffix(1); 87 host_trimmed.remove_suffix(1);
102 } 88 }
103 return host_trimmed.as_string(); 89 return host_trimmed.as_string();
104 } 90 }
105 91
106 } // namespace net 92 } // namespace net
OLDNEW
« no previous file with comments | « net/base/dns_util.h ('k') | net/base/dns_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698