Search code examples
uriprotocolsstring-lengthmaxlength

Is there a maximum length for a protocol name?


In a URI, we have several parts. The first part is the protocol, such as http, ftp, smtp, etc. Is there an RFC or similar document that limits the length of the protocol?

From what I can see in my /etc/services file, the length remains very short, but I would imagine it could be much longer than that?


Solution

  • No, there is no formal restriction on length or "scheme" portion of the Uri (which you call "protocol") - Uniform Resource Identifier (URI): Generic Syntax, section 3.1

    scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

    You may also refer to web protocols - relationship between Uri schema (like http or ftp) and web protol (like HTTP or FTP) covered in URI Schemes and Web Protocols.