I don't know much about RFC3986 but from a quick look, it appears to me that github is abusing the spec and uses the port for the repository owner. I.e. according to the specification, ssh URIs are roughly user@host:port/path and Github SSH URIs are as follows: git@github.com:owner/repo.git. Problem is that the port should be composed of digits only and that's not the case of github users and organisations names.
I didn't know about this before and was trying to use uri to parse URIs in dune-release rather than relying on our own parsers and that abuse of the port part is preventing me from doing so. Uri.of_string behaviour is a bit surprising here though: it succeeds but I'm then unable to get that information back from the Uri.t it returned since port is defined as:
val port : t -> int option
and therefore returns None in my case.
Shouldn't Uri.from_string fail in such cases? If so then I'd understand that you would not want to provide a way to parse such URIs as it doesn't follow the RFC even though I'd love it to be able to use some unsafe API in uri to do so!
I don't know much about RFC3986 but from a quick look, it appears to me that github is abusing the spec and uses the port for the repository owner. I.e. according to the specification, ssh URIs are roughly
user@host:port/pathand Github SSH URIs are as follows:git@github.com:owner/repo.git. Problem is that the port should be composed of digits only and that's not the case of github users and organisations names.I didn't know about this before and was trying to use
urito parse URIs in dune-release rather than relying on our own parsers and that abuse of the port part is preventing me from doing so.Uri.of_stringbehaviour is a bit surprising here though: it succeeds but I'm then unable to get that information back from theUri.tit returned sinceportis defined as:and therefore returns
Nonein my case.Shouldn't
Uri.from_stringfail in such cases? If so then I'd understand that you would not want to provide a way to parse such URIs as it doesn't follow the RFC even though I'd love it to be able to use some unsafe API inurito do so!