HTTP header field (source code)

= HTTP header field
{c}

An <HTTP header field> is named information carried in an HTTP message's header section. Its definition determines how its value is interpreted. Field names are case-insensitive, while values follow the rules of their particular field rather than one universal casing rule.<HTTP Semantics>[§§5.1 and 6.3, field names and header fields]{ref}

For example, `ETag: "AbC"` and `etag: "abc"` use the same field name but different <entity tags>. The quoted opaque strings are compared character by character under the relevant tag-comparison rules. Lowercasing both names is harmless for identifying the field; lowercasing all values would erase a real distinction.<HTTP Semantics>[§8.8.3.2, entity-tag comparison]{ref}

Other fields express different kinds of information. `Content-Type: text/plain; charset=utf-8` describes a <media type> and character encoding for content. It does not contain the content itself, and its meaning cannot be inferred by applying the entity-tag grammar to it.

In <HTTP 1.1>, a textual field line places a colon between the name and value; an empty line terminates the header section. This is a wire-format example, not a requirement that every HTTP version transmit identical text lines.<HTTP 1.1 (RFC 9112)>[§§2.1 and 5, message format and field syntax]{ref}

Repeated field occurrences also need their own semantics. Some can be combined as ordered lists, but treating every header section as a dictionary with exactly one value per name can lose information. Read the field definition before combining lines or rearranging values.<HTTP Semantics>[§§5.2–5.3, field lines and order]{ref}