Skip to content

HTTP header names are not unique #2

@KirkBrooks

Description

@KirkBrooks

https://github.com/ThomasMaul/Classes/blob/main/Project/Sources/Classes/tools.4dm

AccessWebVariables returns the headers as an object. This is fast but there are times when a header name may be duplicated.

RFC 7230 Section 3.2

A sender MUST NOT generate multiple header fields with the same field
name in a message unless either the entire field value for that
header field is defined as a comma-separated list [i.e., #(values)]
or the header field is a well-known exception (as noted below).

A recipient MAY combine multiple header fields with the same field
name into one "field-name: field-value" pair, without changing the
semantics of the message, by appending each subsequent field value to
the combined field value in order, separated by a comma. The order
in which header fields with the same field name are received is
therefore significant to the interpretation of the combined field
value; a proxy MUST NOT change the order of these field values when
forwarding a message.

Of course even the spec is not entirely specific. "The sender must not generate multiple header fields with the same field name..." except when they can and the recipient may, or may not, combine them in which case the order becomes significant.

There is also the issue of capitalization using field names for keys. I think in context, used primarily internally, it's not a problem. But applied more generally it can create results that are hard to analyze the source of. These are edge cases but that's where the bugs like to live.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions