Skip to content

Main content

Media Type Offer Specificity Order

Stable-order bare MIME ranges by exact/type-wildcard/all-wildcard specificity only; excludes qualities, parameters and offer preference.

Loading tool…

Description

Stable-order bare MIME ranges by exact/type-wildcard/all-wildcard specificity only; excludes qualities, parameters and offer preference.

A media type has a type/subtype token and may carry named parameters. Multipart content uses explicit boundary delimiter lines around its parts. Token case rules, parameter quoting, repeated records and exact line endings affect how a representation is interpreted; a lexical check is narrower than parsing a complete message.1

Stable-order bare MIME ranges by exact/type-wildcard/all-wildcard specificity only; excludes qualities, parameters and offer preference.

When to use this tool

Use this tool to order bare MIME ranges from exact matches through type wildcards to the all-types wildcard, preserving input order within each specificity class.

How to use the tool and how it works

  1. Enter ranges using the field definitions below.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.ranges. Use the ordering, boundary rules and absence conditions described below.

Classify ranges as concrete, type wildcard or full wildcard with specificity 2, 1 or 0, then stably sort descending by specificity.2

Input fieldMeaning and unitsAccepted input
rangesBare type/subtype ranges to order by specificity.Dense list of at most 128 strings, each at most 8,192 UTF-16 code units.
Output fieldInterpretation
resultObject containing the named fields below.
result.rangesRanges sorted by descending specificity, with original index and specificity score.
json
{
  "input": {
    "ranges": [
      "*/*",
      "text/*",
      "text/html"
    ]
  },
  "output": {
    "result": {
      "ranges": [
        {
          "range": "text/html",
          "index": 2,
          "specificity": 2
        },
        {
          "range": "text/*",
          "index": 1,
          "specificity": 1
        },
        {
          "range": "*/*",
          "index": 0,
          "specificity": 0
        }
      ]
    }
  }
}

Limitations and assumptions

  • This is not complete Accept negotiation: quality weights, parameters and server preference are not included.
  • Supported boundary strings contain 1–70 characters from the declared MIME boundary subset and cannot end in a space. Single-byte envelope budgets are distinct from UTF-8 text byte counts and from a complete MIME transport.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Choose the target media-type and multipart conventions explicitly. Use a complete MIME parser for nested messages and encodings; these record and delimiter tools handle only their stated representations.

References

  1. RFC 2046: MIME Media Types — RFC Editor

  2. Tool behavior and example: Media Type Offer Specificity Order — tool.io

Similar or alternative tools

  • Media Type Wildcard Offer Match

    Match explicit */*, type/* or exact MIME ranges against complete offers with ASCII case folding; no quality, parameters or suffix wildcard matching.

  • Media Type Parameter Conflict Table

    Audit conflicting decoded MIME parameter values under case-insensitive names and case-sensitive literal values; no registered-parameter equivalence inference.