diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2018-07-04 16:10:40 -0700 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2018-07-04 16:10:40 -0700 |
commit | 98a41c1c33cead6dcb6737d7e3038111814f672d (patch) | |
tree | d239528cd621fe66c9a299fb21a22e7a2ae1e6a0 /src/Uri.cpp | |
parent | fe976143fe4c505beeca78e842602716c97b2018 (diff) |
Fix bug in parsing out IPv6 and IPvFuture addresses
Don't include the square brackets in the parsed out
host string; they are only there for delimiting them
inside of an overall URI string.
Diffstat (limited to 'src/Uri.cpp')
-rw-r--r-- | src/Uri.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Uri.cpp b/src/Uri.cpp index 777aca2..56889b7 100644 --- a/src/Uri.cpp +++ b/src/Uri.cpp @@ -651,7 +651,6 @@ namespace Uri { switch(hostParsingState) { case HostParsingState::FIRST_CHARACTER: { if (c == '[') { - host.push_back(c); hostParsingState = HostParsingState::IP_LITERAL; break; } else { @@ -698,12 +697,13 @@ namespace Uri { case HostParsingState::IPV6_ADDRESS: { // TODO: research this offline first // before attempting to code it - host.push_back(c); if (c == ']') { if (!ValidateIpv6Address(host)) { return false; } hostParsingState = HostParsingState::GARBAGE_CHECK; + } else { + host.push_back(c); } } break; @@ -717,11 +717,12 @@ namespace Uri { } break; case HostParsingState::IPV_FUTURE_BODY: { - host.push_back(c); if (c == ']') { hostParsingState = HostParsingState::GARBAGE_CHECK; } else if (!IPV_FUTURE_LAST_PART.Contains(c)) { return false; + } else { + host.push_back(c); } } break; |