New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ipv6 parser #4241
Fix ipv6 parser #4241
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The failing test does parse in non-http4s decoders.
.map { case ((ls: Option[List[Short]], r0: Short), rs) => | ||
toIpv6(ls.getOrElse(Seq.empty), Seq(r0) ++ rs) | ||
}) | ||
.orElse(((h16.repSep0(0, 3, colon).with1 <* doubleColon) ~ h16Colon.repExactlyAs[List[Short]](2).backtrack ~ ls32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why (0, 3) instead of (3, 3)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would fail on e.g. 53f6::1:551b:7bd8
the number of segments after ::
are always fixed to a number n. so before the ::
we can parse up to 8 - n segments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. So this is part of the bug fix.
Oh, that address was invalid because a |
I have an alternative fix here #4243 which also handles that case and IMO is a bit easier to understand. let me know which one you prefer and I can resolve the conflicts afterwards |
should hopefully fix #4145 (review)
but the following test fails:
but I don't really see why the ip address is invalid