Skip to content

Main content

HTTP Header Occurrence Stable Merge

Append two explicit ordered HTTP field occurrence lists with source-side/index provenance, preserving Set-Cookie and all repeated values rather than comma combining.

Loading tool…

Description

Append two explicit ordered HTTP field occurrence lists with source-side/index provenance, preserving Set-Cookie and all repeated values rather than comma combining.

HTTP field names are case-insensitive, while values follow each field’s own grammar. Repeated occurrences sometimes form lists but cannot always be combined. Quoted values, optional spaces/tabs and quality weights need their own treatment; the tools here use explicit field records or a stated text subset.1

Append two explicit ordered HTTP field occurrence lists with source-side/index provenance, preserving Set-Cookie and all repeated values rather than comma combining.

When to use this tool

Use this tool to append two explicit ordered HTTP field occurrence lists with source-side/index provenance, preserving Set-Cookie and all repeated values rather than comma combining.

How to use the tool and how it works

  1. Enter leftJson, rightJson using the field definitions below. For JSON text, serialize the explicit records in the shown shape.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.headers, result.sources. Use the ordering, boundary rules and absence conditions described below.

Concatenate validated left then right header occurrences and return a parallel list of side and original side-local index.2

Input fieldMeaning and unitsAccepted input
leftJsonJSON text encoding array of {name: string, value: string}. Keep the record keys and value types shown in the decoded example below.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.
rightJsonJSON text encoding array. Keep the record keys and value types shown in the decoded example below.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.

These are the decoded structures used in the example’s JSON text fields. Supply the corresponding serialized JSON strings as input.

json
{
  "leftJson": [
    {
      "name": "X-A",
      "value": "one"
    },
    {
      "name": "x-a",
      "value": "two"
    },
    {
      "name": "Set-Cookie",
      "value": "a=1"
    }
  ],
  "rightJson": []
}
Output fieldInterpretation
resultObject containing the named fields below.
result.headersSelected, redacted or concatenated header occurrences, with indexes where stated.
result.sourcesParallel left/right side and side-local source-index records.
json
{
  "input": {
    "leftJson": "[{\"name\":\"X-A\",\"value\":\"one\"},{\"name\":\"x-a\",\"value\":\"two\"},{\"name\":\"Set-Cookie\",\"value\":\"a=1\"}]",
    "rightJson": "[]"
  },
  "output": {
    "result": {
      "headers": [
        {
          "name": "X-A",
          "value": "one"
        },
        {
          "name": "x-a",
          "value": "two"
        },
        {
          "name": "Set-Cookie",
          "value": "a=1"
        }
      ],
      "sources": [
        {
          "side": "left",
          "index": 0
        },
        {
          "side": "left",
          "index": 1
        },
        {
          "side": "left",
          "index": 2
        }
      ]
    }
  }
}

Limitations and assumptions

  • No duplicates are combined and no header-specific override semantics are inferred.
  • Explicit header records have name and value strings. Names must use token syntax; supported value code units are tab or 32–255 excluding DEL. Byte budgets use that single-byte representation, not UTF-8 or HTTP/2 compression.
  • 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 field-specific parsing and combination rules rather than applying one policy to every header. Preserve occurrence order and use a full HTTP implementation for message framing and protocol-level decisions.

References

  1. RFC 9110: HTTP Semantics — RFC Editor

  2. Tool behavior and example: HTTP Header Occurrence Stable Merge — tool.io

Similar or alternative tools

  • HTTP Header Occurrence Byte Budget

    Budget HTTP/1 field section octets under literal name-colon-space-value-CRLF serialization plus final CRLF; Latin-1 octets, not HTTP/2 compression or UTF-8.

  • HTTP Header Occurrence Case Collisions

    Audit HTTP field-name spelling collisions separately from repeated identical spellings; validates token names and Latin-1 field-value octets.