scheme: // user:pass @ host:port /some/path ?a=multi&part=query #fragment
http: // foo:P4s$ @ example.com:8080 /also/a/path ?id=1&task=2 #some_ref
- If the
//
is absent, then the URI is considered non-hierarchical, and the interpretation of all data after the scheme:
is left up to the handling client. In practice, most clients follow the conventions used for hierarchical URIs.
- The
//
, @
, #
, and ?
are separators. Thus, for example, http://example.com&foo=bar@167772161/
actually points to 10.0.0.1 (in decimal format), with example.com&foo=bar
being interpreted as a username to be used for any prospective authentication!
- According to the relevant RFC, the
host
must be either a valid domain name or canonical IPv4 or (bracket enclosed) IPv6 address. However, most parsing libraries will accept decimal, octal, hexadecimal, and even mixed-format IP addresses!
- While the query string is typical represented as a series of
&
-delimited key/value pairs, this is actually an arbitrary string whose interpretation is left up to the server.
- The fragment is also an arbitrary string, but whose interpretation is left up to the client (and is not supposed to be sent to the server).