Skip to content

Main content

Cache Directive Numeric Value Audit

Audit unsigned decimal syntax of caller-declared numeric cache directives without coercing or accepting signs, quotes or defaults; values remain raw strings.

Loading tool…

Description

Audit unsigned decimal syntax of caller-declared numeric cache directives without coercing or accepting signs, quotes or defaults; values remain raw strings.

HTTP caches distinguish storage policy, freshness and validation. Age and freshness lifetime are durations in seconds; an entity tag is an opaque validator that can be marked weak. Vary identifies request fields relevant to representation selection. A focused arithmetic or token check alone does not decide whether a stored response may be reused.

Audit unsigned decimal syntax of caller-declared numeric cache directives without coercing or accepting signs, quotes or defaults; values remain raw strings.

When to use this tool

Use this tool to audit unsigned decimal syntax of caller-declared numeric cache directives without coercing or accepting signs, quotes or defaults; values remain raw strings.

How to use the tool and how it works

  1. Enter directivesJson, numericNames using the input definitions below. Serialize the JSON text fields in the decoded shape shown below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.values. Interpret signs, units, ordering and null values using the rules below.

Select explicit directives whose normalized names occur in numericNames. For each return its source index, name, raw value and valid only when value is a non-null string of one or more ASCII decimal digits.1, 2

Input fieldMeaning and unitsAccepted input
directivesJsonJSON array of {name,value} directives: HTTP token name and a string value or null for a bare directive. Names are normalized to lowercase.Text, at most 8,192 UTF-16 code units; the stated grammar and narrower limits also apply.
numericNamesCaller-declared directive names whose raw values should have unsigned decimal-digit syntax.Dense list of at most 128 strings, each at most 8,192 UTF-16 code units.

These decoded examples show the structure of the JSON text fields. Supply each as its corresponding serialized JSON string.

json
{
  "directivesJson": [
    {
      "name": "max-age",
      "value": "5"
    },
    {
      "name": "max-age",
      "value": "-1"
    }
  ]
}
Output fieldInterpretation
resultObject containing the fields below.
result.valuesSelected numeric-directive occurrences retaining raw value and decimal-syntax valid flag.
json
{
  "input": {
    "directivesJson": "[{\"name\":\"max-age\",\"value\":\"5\"},{\"name\":\"max-age\",\"value\":\"-1\"}]",
    "numericNames": [
      "max-age"
    ]
  },
  "output": {
    "result": {
      "values": [
        {
          "index": 0,
          "name": "max-age",
          "valid": true,
          "value": "5"
        },
        {
          "index": 1,
          "name": "max-age",
          "valid": false,
          "value": "-1"
        }
      ]
    }
  }
}

Limitations and assumptions

  • The check does not parse a numeric magnitude, enforce a directive-specific limit, accept quotes/signs or provide defaults.
  • No HTTP exchange, cache store, clock or server is accessed. Header/directive occurrences and timestamps are supplied explicitly. Durations use seconds for HTTP semantics; timestamps must share an origin and unit.
  • Every declared top-level input is required and unknown 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 within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.

Alternative or Complementary methods

Combine these focused results with the request/response caching rules applicable to the actual exchange. Preserve field occurrences and distinguish freshness calculations, validator comparison and complete cache-reuse authorization.

References

  1. RFC 9111: HTTP Caching — RFC Editor

  2. Tool behavior and example: Cache Directive Numeric Value Audit — tool.io

Similar or alternative tools

  • Cache Directive Extension Inventory

    Inventory explicit cache directive names outside a caller-provided known-name bank; no hardcoded current registry or automatic extension semantics.

  • Cache Directive Occurrence Conflict Audit

    Audit conflicting explicit Cache-Control directive occurrences under case-insensitive names, distinguishing bare/null from empty values; no conflict-resolution policy.