HTTP Link Header Parser

Parse RFC 8288 link targets and parameters while retaining quoted delimiters and repeated relation parameters.

Description

A Link field relates a target URI reference to the current resource through named parameters such as rel.

A Link field relates a target URI reference to the current resource through named parameters such as rel. Multiple links and repeated parameters can retain meaningful source order.1, 2

Parse RFC 8288 link targets and parameters while retaining quoted delimiters and repeated relation parameters.

When to use HTTP Link Header Parser

Use this tool to parse RFC 8288 link targets and parameters while retaining quoted delimiters and repeated relation parameters.

Prepare the header field value, cookie records or status code requested. Supply field values without a header-name prefix and preserve syntax for the parser to inspect.

How to use HTTP Link Header Parser and understand its results

  1. Prepare the header field value, cookie records or status code requested. Supply field values without a header-name prefix and preserve syntax for the parser to inspect.
  2. Enter header using the field table and calculation rules, then run the tool.
  3. Read links. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
headerLink field value.string; maximum length: 1000000Required

Paste the field value. Split commas and semicolons outside quoted strings and angle brackets; require each target to be enclosed in < > without whitespace. Lowercase parameter names, unquote values and remove quoted-pair escaping. Preserve target text, value case, parameter order and duplicates. Empty comma groups are skipped.3

links=ordered angle-bracket targets with ordered name/value parameters

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
linksLinks in header order.list of object; minimum entries: 0; maximum entries: 100000
json
{
  "input": {
    "header": "</next?page=2>; rel=\"next\"; title=\"Next, page\", <https://example.com/help>; rel=help"
  },
  "output": {
    "links": [
      {
        "target": "/next?page=2",
        "parameters": [
          {
            "name": "rel",
            "value": "next"
          },
          {
            "name": "title",
            "value": "Next, page"
          }
        ]
      },
      {
        "target": "https://example.com/help",
        "parameters": [
          {
            "name": "rel",
            "value": "help"
          }
        ]
      }
    ]
  }
}

Limitations and assumptions

No URI resolution, fetching, relation selection or complete semantic validation is supplied. Unbalanced quoting, invalid parameters and header controls are input errors.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use HTTP Forwarded Parser: Parse RFC 7239 Forwarded elements into ordered parameter lists without inferring proxy trust or validating addresses. For a complementary task, use HTTP Content-Disposition Parser: Parse a disposition type and unquote its parameters, preserving RFC 5987 extended values for caller interpretation.

Further background: RFC 8288: Web Linking.

References

  1. HTTP Link Header Parser — tool.io

  2. RFC 8288: Web Linking — Internet Engineering Task Force

  3. HTTP Content-Type Parser — tool.io

Similar or alternative tools

  • HTTP Forwarded Parser

    Parse RFC 7239 Forwarded elements into ordered parameter lists without inferring proxy trust or validating addresses.

  • HTTP Content-Disposition Parser

    Parse a disposition type and unquote its parameters, preserving RFC 5987 extended values for caller interpretation.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies