d_storage.append(begiter,iter);
if(iter != pend)
++iter;
- if(labellen > 63)
+ if(labellen > s_maxDNSLabelLength)
throwSafeRangeError("label too long to append: ", p, length);
if(iter-pbegin > static_cast<ptrdiff_t>(s_maxDNSNameLength - 1)) // reserve two bytes, one for length and one for the root label
if (length == 0) {
throw std::range_error("no such thing as an empty label to append");
}
- if (length > 63) {
+ if (length > DNSName::s_maxDNSLabelLength) {
throw std::range_error("label too long to append");
}
}
}
return true;
}
- if (static_cast<uint8_t>(*us) > 63) {
+ if (static_cast<uint8_t>(*us) > s_maxDNSLabelLength) {
throw std::out_of_range("illegal label length in DNSName");
}
}
class DNSName
{
public:
- static const size_t s_maxDNSNameLength = 255;
+ static constexpr size_t s_maxDNSNameLength = 255;
+ static constexpr size_t s_maxDNSLabelLength = 63;
DNSName() = default; //!< Constructs an *empty* DNSName, NOT the root!
// Work around assertion in some boost versions that do not like self-assignment of boost::container::string