Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A big mapping url schemes to their protocols' default ports. See comments below for notes. Painstakingly assembled by crossreferencing https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml and https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
{
"acap": 674,
"afp": 548,
"dict": 2628,
"dns": 53,
"file": null,
"ftp": 21,
"git": 9418,
"gopher": 70,
"http": 80,
"https": 443,
"imap": 143,
"ipp": 631,
"ipps": 631,
"irc": 194,
"ircs": 6697,
"ldap": 389,
"ldaps": 636,
"mms": 1755,
"msrp": 2855,
"msrps": null,
"mtqp": 1038,
"nfs": 111,
"nntp": 119,
"nntps": 563,
"pop": 110,
"prospero": 1525,
"redis": 6379,
"rsync": 873,
"rtsp": 554,
"rtsps": 322,
"rtspu": 5005,
"sftp": 22,
"smb": 445,
"snmp": 161,
"ssh": 22,
"steam": null,
"svn": 3690,
"telnet": 23,
"ventrilo": 3784,
"vnc": 5900,
"wais": 210,
"ws": 80,
"wss": 443,
"xmpp": null
}
[
"mailto",
"about",
"sip",
"tel",
"data",
"urn",
"bitcoin",
"pkcs11",
"magnet",
"blob",
"sips",
"news",
"geo"
]
@mahmoud

This comment has been minimized.

Copy link
Owner Author

@mahmoud mahmoud commented Mar 13, 2017

A null in the scheme_port_map indicates a protocol that uses a "//" but does not use a (known) port.

The schemes_without_netloc.json file is a short list of common URL schemes that affirmatively do not use network location (no // in the URL).

@mahmoud

This comment has been minimized.

Copy link
Owner Author

@mahmoud mahmoud commented Mar 13, 2017

Note that the list is hand assembled, and not automatically generatable, as the name in the IANA scheme registry does not always map well to the IANA port registry. So this made mostly by hand looking up in the port registry, or the linked RFC. Some schemes do not have RFCs linked, and some RFCs do not mention the default port, so some independent research was also necessary.

Anyways, hope I saved someone else the trouble! (Python versions of the above can be imported from boltons's urlutils submodule).

@pgroke-dt

This comment has been minimized.

Copy link

@pgroke-dt pgroke-dt commented May 14, 2018

Hi,
nice list! If you want others to benefit from this, it would be helpful though if you add some kind of license or explicitly release it into public domain.

@mahmoud

This comment has been minimized.

Copy link
Owner Author

@mahmoud mahmoud commented May 1, 2021

@pgroke-dt, just seeing this, and while I think this might be too small an artifact to be copyrightable per se (facts are not copyrightable), if it eases anyone's concerns further, I'm happy to say that the contents of this gist are licensed CC0.

Also, in addition to boltons, the mapping is available in hyperlink as well. :)

@pgroke-dt

This comment has been minimized.

Copy link

@pgroke-dt pgroke-dt commented May 3, 2021

Yes, you're probably right re. being non copyrightable. I think your comment here should be enough in case anyone has concerns. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment