Net.HTTP.H1.Classes

lib/Net/HTTP/H1/Classes.gob

The byte classes of RFC 9110 and RFC 9112 as 256-entry tables, and the scan loop every part of the HTTP/1 codec reads them with. A table is an array indexed by the byte, so a class test is one load.

Each table is exactly its rule's class and nothing looser: ows is SP and HTAB only, and no class but ows and fieldChar holds any control byte.

let sp : Int
let htab : Int
let cr : Int
let lf : Int
let colon : Int
let semicolon : Int
let comma : Int
let slash : Int
let star : Int
let dot : Int
let question : Int
let equals : Int
let quote : Int
let backslash : Int
let openBracket : Int
let closeBracket : Int
let tchar : Array Bool

tchar, RFC 9110 §5.6.2.

let targetChar : Array Bool

The bytes a request target may hold: visible ASCII, except "#", since a fragment is never sent. RFC 3986 allows fewer, but clients send "{", "}", "|" and the like unencoded, and the form checks after the grammar are what framing and routing depend on.

let fieldVchar : Array Bool

field-vchar, RFC 9110 §5.5: VCHAR or obs-text. Never a control byte, so never CR, LF or NUL.

let fieldChar : Array Bool

A byte of field-value or of the whitespace beside it.

let reasonChar : Array Bool

reason-phrase, RFC 9112 §4: HTAB, SP, VCHAR and obs-text.

let quotedChar : Array Bool

qdtext, RFC 9110 §5.6.4, which a chunk extension's quoted value holds.

let ows : Array Bool

OWS, RFC 9110 §5.6.3: SP and HTAB, nothing else.

let digit : Array Bool
let hexDigit : Array Bool
let alpha : Array Bool
let schemeChar : Array Bool

RFC 3986 §3.1: the bytes after a scheme's first letter.

let regNameChar : Array Bool

RFC 3986 §3.2.2: reg-name, unreserved / pct-encoded / sub-delims.

let ipv6Char : Array Bool

The bytes inside an IP literal's brackets.

fun scan : fun(Array Bool, Array Byte, Int, Int) -> Int

Returns the first index from p before to whose byte is not in table, or to.

fun isByte : fun(Array Byte, Int, Int, Int) -> Bool
fun isCrlf : fun(Array Byte, Int, Int) -> Bool
fun sameText : fun(Array Byte, Int, Int, Array Byte) -> Bool

Returns whether s[from..to) is want, where want is lowercase ASCII and the bytes may be in either case.

fun hexValue : fun(Int) -> Int

Returns the value of the hex digit b, which hexDigit holds.

fun ascii : fun(Array Byte, Int, Int) -> String

Returns s[from..to), which is ASCII, as a string.

fun lowerText : fun(Array Byte, Int, Int) -> String

Returns s[from..to), which is ASCII, as a lowercase string.