cpp-netlib/uri — pull request #53 by lacop (2014-12-01 17:56:05+00:00)
Title: Fix host parsing priority according to RFC 3986.

This should fix cpp-netlib/cpp-netlib#450. There isn't an issue for this in the cpp-netlib/uri repository.

The host rule is ambiguous unless we process the subrules in specific order and pick the first which matches.

However, Spirit parser is greedy and will match hostnames like `1.2.3.4.example.com` to be an IPv4 address. Then we return from the host rule and further parsing will fail (trying to parse `.example.com` as port or path).

To fix this, we make sure that there isn't another dot after the IP. This fixes hosts which have some IPv4 address like prefix. The `ip_literal` rule doesn't need this, since it's wrapped inside `[]` and thus is unambiguous.

I've added two test cases for this. There is also third test case (`construct_uri_like_short_ipv4`), which passes without this fix but should prevent future regressions.