Section 5 of RFC 5988 defines the syntax of the Link header as follows:
Link = "Link" ":" #link-value
link-value = "<" URI-Reference ">" *( ";" link-param )
This specification uses augmented Backus-Naur Form (BNF) as defined in RFC 822.
If understand BNF correctly, the specification does not permit whitespace between the semicolon (;
) and link-param
. However, in the examples which appear in Section 5, there is whitespace between the two elements:
Link: <http://example.com/TheBook/chapter2>; rel="previous";
title="previous chapter"
Link: </>; rel="http://example.net/foo"
I also observed whitespace in the Link header in Github's API which I consider one of the more standard-compliant APIs:
$ curl -s -I https://api.github.com/users/mitsuhiko/repos
...
Link: <https://api.github.com/user/7396/repos?page=2>; rel="next", <https://api.github.com/user/7396/repos?page=7>; rel="last"
Is whitespace supposed to be permissible? I can't find anything which provides evidence either way besides these examples.
It is permissible; RFC 5988 uses ABNF as defined by RFC 2616, which has special rules for linear white space. See https://www.greenbytes.de/tech/webdav/rfc5988.html#rfc.section.2.p.2 and https://www.greenbytes.de/tech/webdav/rfc2616.html#rfc.section.2.1:
The grammar described by this specification is word-based. Except where noted otherwise, linear white space (LWS) can be included between any two adjacent words (token or quoted-string), and between adjacent words and separators, without changing the interpretation of a field. At least one delimiter (LWS and/or separators) MUST exist between any two tokens (for the definition of "token" below), since they would otherwise be interpreted as a single token.
FWIW, RFC 5988 has been obsoleted a few months ago anyway; see RFC 8288 (https://www.greenbytes.de/tech/webdav/rfc8288.html) for the latest and greatest (specifically Section 3).