Skip to content

Main content

HTTP Range Single Suffix Token Tool

Calculate http range single suffix token from explicit caller-supplied inputs.

Loading tool…

Description

Return length as a nonnegative safe integer and nonzero when length>0.

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.

Return length as a nonnegative safe integer and nonzero when length>0.

When to use this tool

Use HTTP Range Single Suffix 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 length, nonzero. Inspect nonzero before interpreting the associated values.

Accept a case-insensitive bytes=- prefix followed by decimal digits. Return length as a nonnegative safe integer and nonzero when length>0.1

Input fieldMeaning and unitsAccepted input
tokenComplete literal token in the grammar stated above.Required. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
lengthLength in the unit stated for the model.Required. Safe integer.
nonzeroWhether suffix length is positive; zero length is parsed but flagged false.Required. Boolean.
json
{
  "input": {
    "token": "bytes=-500"
  },
  "output": {
    "length": 500,
    "nonzero": true
  }
}

Limitations and assumptions

  • Leading zeros and length zero are accepted by this token parser. Nonzero=false identifies a zero suffix length; no complete Range header, resource length, satisfiability, or HTTP response is determined.
  • 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-range-single-suffix-token — tool.io

Similar or alternative tools