void DNSName::appendRawLabel(const std::string& label)
{
if(label.empty())
- throw std::range_error("no such thing as an empty label");
+ throw std::range_error("no such thing as an empty label to append");
if(label.size() > 63)
- throw std::range_error("label too long");
+ throw std::range_error("label too long to append");
if(d_storage.size() + label.size() > 253) // reserve two bytes, one for length and one for the root label
- throw std::range_error("name too long");
+ throw std::range_error("name too long to append");
d_storage.append(1, (char)label.size());
d_storage.append(label.c_str(), label.length());
void DNSName::prependRawLabel(const std::string& label)
{
if(label.empty())
- throw std::range_error("no such thing as an empty label");
+ throw std::range_error("no such thing as an empty label to prepend");
if(label.size() > 63)
- throw std::range_error("label too long");
+ throw std::range_error("label too long to prepend");
if(d_storage.size() + label.size() > 253) // reserve two bytes, one for length and one for the root label
- throw std::range_error("name too long");
+ throw std::range_error("name too long to prepend");
string_t prep(1, (char)label.size());
prep.append(label.c_str(), label.size());
{
// this removes duplicates from the packet in case we are not compressing
// for AXFR, no such checking is performed!
- //cerr<<"addrecord, content=["<<rr.content<<"]"<<endl;
+ cerr<<"addrecord, content=["<<rr.content<<"]"<<endl;
if(d_compress)
for(vector<DNSResourceRecord>::const_iterator i=d_rrs.begin();i!=d_rrs.end();++i)
if(rr.qname==i->qname && rr.qtype==i->qtype && rr.content==i->content) {
return;
}
- //cerr<<"added to d_rrs"<<endl;
+ cerr<<"added to d_rrs"<<endl;
d_rrs.push_back(rr);
}
{
// string label = d_lowerCase ? toLower(Label) : Label;
// FIXME: we ignore d_lowerCase for now
- //cerr<<"xfrName writing ["<<name.toString()<<"]"<<endl;
+ cerr<<"xfrName writing ["<<name.toString()<<"]"<<endl;
std::vector<std::string> parts = name.getRawLabels();
// labelparts_t parts;
- //cerr<<"labelcount: "<<parts.size()<<endl;
+ cerr<<"labelcount: "<<parts.size()<<endl;
if(d_canonic)
compress=false;
unsigned int startPos;
for(auto &label: parts) {
- //cerr<<"xfrName labelpart ["<<label<<"]"<<endl;
+ cerr<<"xfrName labelpart ["<<label<<"]"<<endl;
// if(deDot)
// chopped.assign(label.c_str() + i->first, labellen - i->first -1);
// else
// }
// else {
char labelsize=label.size();
- //cerr<<"labelsize = "<<int(labelsize)<<" for label ["<<label<<"]"<<endl;
+ cerr<<"labelsize = "<<int(labelsize)<<" for label ["<<label<<"]"<<endl;
d_record.push_back(labelsize);
unsigned int len=d_record.size();
d_record.resize(len + labelsize);