Skip to content

Uri with github flavored SSH URIs #154

Description

@NathanReb

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions