Skip to content

Main content

Parsing: HTTP Qvalue Single Token Tool

Parse one strict RFC9110 qvalue, allowing at most three fractional digits and only zero fractions after one; no whole-header parsing.

Loading tool…

Description

Parse one strict RFC9110 qvalue, allowing at most three fractional digits and only zero fractions after one; no whole-header parsing.

HTTP fields use specific token, quoted-string, range, quality-weight, and entity-tag grammars. Quoted text is not automatically safe as a filename or equivalent to an escaped string in another language. Parsing one parameter or marker is separate from interpreting a full request or response.

Parse one strict RFC9110 qvalue, allowing at most three fractional digits and only zero fractions after one; no whole-header parsing.

When to use this tool

Use Parsing: HTTP Qvalue Single Token when you need to parse this one supported HTTP field component or parameter token.

How to use the tool and how it works

  1. Enter token. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Accept 0 or 1 with an optional decimal point and up to three fractional digits, requiring only zeros after one. Return the numeric quality inside result.1

HTTP quality weights range from zero to one, with at most three fractional digits in the qvalue syntax. Zero denotes an unacceptable preference in negotiation, though this tool only parses the numeric token.2

Input fieldMeaning and unitsAccepted input
tokenComplete literal token in the grammar stated above.Required. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
Output fieldInterpretationReturned shape
resultObject containing the calculated result members described below.Required. Object.
result.qualityNumeric qvalue between zero and one.Calculated result member: number.
json
{
  "input": {
    "token": "0.750"
  },
  "output": {
    "result": {
      "quality": 0.75
    }
  }
}

Limitations and assumptions

  • The grammar allows 0. and 1. but rejects .5, excess precision, whitespace, and a q= prefix. It parses one qvalue without content negotiation or preference sorting.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use a full header parser and the relevant HTTP semantics when request behavior depends on the result. Check extended parameters, field context, and downstream use of returned text separately.

References

  1. Calculation and input contract: parse/http-qvalue-single-token — tool.io

  2. RFC 9110: Quality Values — IETF / RFC Editor

Similar or alternative tools