Every rule for a base URL, in order: a non-blank string, no whitespace or control
characters (see baseUrlWhitespaceProblem), a parseable absolute URL, the
http: or https: scheme, and no query or fragment — request paths are appended
to the base URL as a string, so a ? or # would swallow every path
(http://h/?x=1 requests /?x=1/api2u/news/, http://h/#f requests /), and no
backslash (WHATWG ends an http(s) host at one, as at a /, while text-based code reads
on, so http://u:pw@127.0.0.1\@remote.example was checked as loopback and its
credentials went to remote.example), and the scheme followed by exactly // and the host (WHATWG
repairs http:host, http:/host and http:///host silently), and no path ending in /api2u
(the client adds it: /api2u/api2u/… is a 404 everywhere). Userinfo is allowed (sent as Basic auth); a % in it must start a valid escape (%25
for a literal one), as it is decoded for the Authorization header. The reasons never
echo the URL, so a credential in it cannot leak.
Every rule for a base URL, in order: a non-blank string, no whitespace or control characters (see baseUrlWhitespaceProblem), a parseable absolute URL, the
http:orhttps:scheme, and no query or fragment — request paths are appended to the base URL as a string, so a?or#would swallow every path (http://h/?x=1requests/?x=1/api2u/news/,http://h/#frequests/), and no backslash (WHATWG ends an http(s) host at one, as at a/, while text-based code reads on, sohttp://u:pw@127.0.0.1\@remote.examplewas checked as loopback and its credentials went to remote.example), and the scheme followed by exactly//and the host (WHATWG repairshttp:host,http:/hostandhttp:///hostsilently), and no path ending in /api2u (the client adds it: /api2u/api2u/… is a 404 everywhere). Userinfo is allowed (sent as Basic auth); a%in it must start a valid escape (%25for a literal one), as it is decoded for the Authorization header. The reasons never echo the URL, so a credential in it cannot leak.