gleam-lang / gleam-lang/stdlib

IPv6 hosts are not correctly represented in the URI module

Open
#881 10 comments 0 reactions 0 assignees View on GitHub
help wanted
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.