HTTP Link Header (RFC 8288) Parser | Split link-values into rel and parameters
Paste one Link header from an HTTP response and split it into comma-separated link-values, then break each one into its <URI>, rel tokens, and parameters like title. A quote-aware tokenizer never breaks on commas that live inside quotes or inside <>.
💡 About this tool
You hit a paginated API, run curl -I, and get back a Link header that crams next, prev, first, and last onto a single line. Eyeballing which URI carries which rel is annoying, and the moment a query string contains a comma or a title value wraps a comma in quotes, a naive .split(",") falls apart and mangles the URLs.
This parser follows the RFC 8288 section 3 grammar link-value = "<" URI ">" *( OWS ";" OWS link-param ). It first splits on top-level commas while tracking <> depth and quote state, so commas inside a URI or inside a quoted string are left alone. Each link-value is then split on semicolons into params, and every name=value or name="quoted" pair is extracted, unescaping backslash sequences inside quoted strings. You get four counters — link-values, rel tokens, unique rels, and total parameters — plus a card per link with rel shown as chips and the remaining params as key = value.
🧐 Frequently Asked Questions
Q. What happens when rel holds more than one value?
A. rel is a space-separated token list, so rel="prev next" is valid. Each token becomes its own chip and feeds both the rel-token total and the unique-rel count.
Q. Will a comma inside a quoted title break the split?
A. No. A value such as title="Page 2, draft" keeps its comma; the parser tracks whether it is inside quotes before deciding where a link-value ends.
Q. My URI has ; and , in the query string. Is that a problem?
A. No. Everything between < and > is captured verbatim as the URI, so reserved characters inside it never trigger a split.
Q. One of my link-values is malformed. Does the whole parse fail?
A. No. A link-value with no opening < is skipped from the counts, and the remaining well-formed link-values are still parsed.
Q. Is there an input limit? A. The Link header must be 20,000 characters or fewer; longer input shows an error.
📚 Fun Facts
The Link header is essentially the HTML <link> element promoted to a response header. It started life in RFC 5988 and is now standardized by RFC 8288. The GitHub REST API leans on rel="next"/rel="prev" for pagination, and the HTTP/2 era popularized rel="preload" as a fetch hint that browsers act on before parsing the body. Relation names live in IANA's Link Relation Types registry, which holds well-known tokens like alternate, canonical, and stylesheet — and the spec also lets you use an absolute URI as an extension relation type.