Re: Domain name label length

Michael Powell <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <CAMEoF_FPGr6no9Nf9j=hfqyN302X64aX0FPu1vo=pN1N4v1L7g@mail.gmail.com>
On Mon, Dec 25, 2017 at 10:38 PM, Michael Powell <[email protected]> wrote:
> Hello,
>
> So, a domain name label looks something like this, in general, right?
>
> _label = _let >> *(_let | _dig | _hyp) >> (_let | _dig);
>
> However, another stipulation is that its length must be <=63 according
> to the RFC:
>
> https://tools.ietf.org/html/rfc1034#section-3.5
>
> So... Is there a way to constrain that using Qi?

Untested, but at least according to this post:

http://boost.2283326.n4.nabble.com/How-to-restrict-an-integer-to-digits-and-specific-range-td2681120.html

The key seems to be in Semantic Actions.

struct validate_label_length {
    template<typename Context>
    void operator()(std::string& label, Context&, bool& pass) {
        pass = label.length() <= 63;
    }
};

And which rule would be:

_label = raw[_let >> -(*(_let | _dig | _hyp) >> (_let |
_dig))][validate_label_length()];


> Cheers,
>
> Michael Powell

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.