This issue comes from Bryan Nebold's post about DID URLs, and I think trurl is parsing empty authorities incorrectly.
The atmosphere URI at://did:plc:whatever/more/path/here is invalid, because did:plc:whatever is an invalid authority; it does not conform to the host:port syntax from RFC 3986. trurl is well within its rights to refuse to parse it:
$ trurl --json 'at://did:plc:vwzwgnygau7ed7b7wt5ux7y2/app.bsky.feed.post/3k5nobkf2w72g'
trurl note: Port number was not a decimal number between 0 and 65535 [at://did:plc:vwzwgnygau7ed7b7wt5ux7y2/app.bsky.feed.post/3k5nobkf2w72g]
[]
However, the URI at:///did:plc:whatever/more/path/here has an extra slash, which should indicate an empty authority, and did:plc:whatever/more/path/here ought to be the path. Firefox parses it like this:
However, trurl treats it exactly the same, tries to parse a port out of what ought to be the first segment of the path, and exits with an error:
$ trurl --json 'at:///did:plc:vwzwgnygau7ed7b7wt5ux7y2/app.bsky.feed.post/3k5nobkf2w72g'
trurl note: Port number was not a decimal number between 0 and 65535 [at:///did:plc:vwzwgnygau7ed7b7wt5ux7y2/app.bsky.feed.post/3k5nobkf2w72g]
[]
If we simplify the URL to see what's going on, trurl will tell us it has parsed the path's first segment as a host:
$ trurl --json 'at:///foo'
[
{
"url": "at://foo/",
"parts": {
"scheme": "at",
"host": "foo",
"path": "/"
}
}
]
trurl appears to be silently removing a semantically important front-slash.
For whatever it's worth, curl seems to behave identically, parsing foo as the host:
$ curl -w '%{url.scheme} %{url.host} %{url.port} %{url.path}\n' 'at:///foo'
curl: (1) Protocol "at" not supported
at foo /
This issue comes from Bryan Nebold's post about DID URLs, and I think
trurlis parsing empty authorities incorrectly.The atmosphere URI
at://did:plc:whatever/more/path/hereis invalid, becausedid:plc:whateveris an invalid authority; it does not conform to thehost:portsyntax from RFC 3986.trurlis well within its rights to refuse to parse it:However, the URI
at:///did:plc:whatever/more/path/herehas an extra slash, which should indicate an empty authority, anddid:plc:whatever/more/path/hereought to be the path. Firefox parses it like this:However,
trurltreats it exactly the same, tries to parse a port out of what ought to be the first segment of the path, and exits with an error:If we simplify the URL to see what's going on,
trurlwill tell us it has parsed the path's first segment as a host:trurlappears to be silently removing a semantically important front-slash.For whatever it's worth, curl seems to behave identically, parsing
fooas the host: