Skip to content

lib: parse bracketed IPv6 server addresses#1807

Open
shumvgolove wants to merge 2 commits into
masterfrom
sh/ipv6-parse-ench
Open

lib: parse bracketed IPv6 server addresses#1807
shumvgolove wants to merge 2 commits into
masterfrom
sh/ipv6-parse-ench

Conversation

@shumvgolove

Copy link
Copy Markdown
Collaborator

instance StrEncoding SrvLoc where
strEncode (SrvLoc host port) = B.pack $ host <> if null port then "" else ':' : port
strP = SrvLoc <$> host <*> (port <|> pure "")
strEncode (SrvLoc host port) = strEncode host <> B.pack (if null port then "" else ':' : port)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
strEncode (SrvLoc host port) = strEncode host <> B.pack (if null port then "" else ':' : port)
strEncode (SrvLoc host port) = case host of
THIPv6 _ | not (null port) -> strEncode ('[', host, ']') <> B.pack (':' : port)
_ -> strEncode host

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants