MCPcopy Create free account
hub / github.com/NativeScript/android / verify_dns_length

Function verify_dns_length

test-app/runtime/src/main/cpp/ada/ada.cpp:111–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111ada_really_inline constexpr bool verify_dns_length(
112 std::string_view input) noexcept {
113 if (input.back() == '.') {
114 if (input.size() > 254) return false;
115 } else if (input.size() > 253)
116 return false;
117
118 size_t start = 0;
119 while (start < input.size()) {
120 auto dot_location = input.find('.', start);
121 // If not found, it's likely the end of the domain
122 if (dot_location == std::string_view::npos) dot_location = input.size();
123
124 auto label_size = dot_location - start;
125 if (label_size > 63 || label_size == 0) return false;
126
127 start = dot_location + 1;
128 }
129
130 return true;
131}
132} // namespace ada::checkers
133/* end file src/checkers.cpp */
134/* begin file src/unicode.cpp */

Callers 1

has_valid_domainMethod · 0.85

Calls 3

backMethod · 0.80
sizeMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected