Net.HTTP.HeaderName

lib/Net/HTTP/HeaderName.gob

The name of a header field: a token, stored lowercase, since field names are case-insensitive and HTTP/2 sends them lowercase.

Reserved names are refused. The fields that frame a message or route it -- how long the body is, whether the connection stays open, which host it is for -- are written by the HTTP library from the request or response it sends, never by the program. A program that could set Content-Length or Transfer-Encoding beside the library's own could frame one message two ways, which is how request smuggling works. So parse refuses those names, and no HeaderName for them exists: a value of this type is a field a program may write.

let reserved : Array String

The fields the library writes itself, lowercase. HTTP/2 forbids or replaces most of them.

fun isReserved : fun(String) -> Bool

Whether s, in any case, names a reserved field.

fun parse : fun(String) -> Either HeaderError HeaderName
fun literal : fun(String) -> HeaderName

Returns s as a header name, and panics if it is not a token or is reserved: a name written in the program's source that is either is a mistake in the program.

fun toString : fun(HeaderName) -> String

Returns the name, lowercase.

type HeaderName

A field name: a token, lowercase, never one of the reserved names.

instance Show HeaderName