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

Unified Diff: net/base/dns_util.cc

Issue 6500010: HSTS: add net-internals UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 10 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
Index: net/base/dns_util.cc
diff --git a/net/base/dns_util.cc b/net/base/dns_util.cc
index f1e0de442babefc5a0e61c9506fc1df78929637c..d97d3d2c9eca4dedd07059df19b0e73bef217431 100644
--- a/net/base/dns_util.cc
+++ b/net/base/dns_util.cc
@@ -56,6 +56,24 @@ bool DNSDomainFromDot(const std::string& dotted, std::string* out) {
return true;
}
+std::string DNSDomainToString(const std::string& domain) {
+ std::string ret;
+
+ for (unsigned i = 0; i < domain.size() && domain[i]; i += domain[i] + 1) {
+ if (domain[i] < 0 || domain[i] > 63)
+ return "";
eroman 2011/02/17 00:48:28 I recommend adding a test case for one of the bad
agl 2011/02/17 17:21:30 Done.
+
+ if (i)
+ ret += ".";
+
+ if (static_cast<unsigned>(domain[i]) + i + 1 > domain.size())
+ return "";
+
+ ret += domain.substr(i + 1, domain[i]);
+ }
+ return ret;
+}
+
bool IsSTD3ASCIIValidCharacter(char c) {
if (c <= 0x2c)
return false;

Powered by Google App Engine
This is Rietveld 408576698