fix(isURL): allow URLs with colon and no port by MatteoPierro · Pull Request #1751 · validatorjs/validator.js

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @MatteoPierro and thank you for your PR!

Is an URL with a colon and no port allowed in IETF standards? if yes can you provide a source?

According to the two RFCs concerning URLs and URls,http://example.com: shouldn't be valid

RFC 3986 ( Uniform Resource Identifier (URI): Generic Syntax)

URI producers and normalizers should omit the port component and its ":" delimiter if port is empty or if its value would be the same as that of the scheme's default

RFC 1738 ( Uniform Resource Locators (URL))

port
The port number to connect to. Most schemes designate protocols that have a default port number. Another port number may optionally be supplied, in decimal, separated from the host by a colon. If the port is omitted, the colon is as well.