gleam-lang / gleam-lang/stdlib
IPv6 hosts are not correctly represented in the URI module
- Dominant language
- Gleam
- Stars
- 710
- Forks
- 225
- Avg merge
- 5h 52m
- Merged PRs (30d)
- 3
Description
When working on this issue:
https://github.com/gleam-lang/httpc/issues/34
and the ensuing discussion on Discord:
https://discord.com/channels/768594524158427167/1440650512319119490
@Nicd identified that the current behaviour of the stdlib uri module is not correct when parsing IPv6 addresses that are given in the URI.
```
let assert Ok(u) = uri.parse("http://[2600:1406:bc00:53::b81e:94c8]")
let us = uri.to_string(u)
echo u
echo us
```
Produces:
```
Uri(Some("http"), None, Some("2600:1406:bc00:53::b81e:94c8"), None, "", None, None)
"http://2600:1406:bc00:53::b81e:94c8/"
```
When the expected output should be:
```
Uri(Some("http"), None, Some("[2600:1406:bc00:53::b81e:94c8]"), None, "", None, None)
"http://[2600:1406:bc00:53::b81e:94c8]/"
```
(Note the brackets around the IPv6 addresses.)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.