HTTP Character Predicates #
This module provides shared character validation predicates used across the HTTP library.
All predicates in this module are ASCII-only by design (isAscii c where applicable), and
intentionally exclude obs-text and all non-ASCII code points.
Checks if a character is ASCII (Unicode code point < 128).
Instances For
Checks if a byte represents an ASCII character (value < 128).
Instances For
Checks if a byte is a decimal digit (0-9).
Instances For
Checks if a byte is an alphabetic character (a-z or A-Z).
Instances For
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
/ "+" / "-" / "." / "^" / "_" / "" / "|" / "~" / DIGIT / ALPHA ; Visible token characters used to build token`.
Instances For
vchar = %x21-7E ; Visible (printing) ASCII characters.
Instances For
qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E ; ASCII-only variant (no obs-text).
Instances For
quoted-pair = "\" ( HTAB / SP / VCHAR ) ; ASCII-only variant (no obs-text).
Instances For
quoted-string body character class: ( qdtext / quoted-pair payload ) in ASCII-only mode.
Instances For
field-vchar = VCHAR ; ASCII-only variant (no obs-text).
Instances For
field-content character class: field-vchar / SP / HTAB ; ASCII-only variant (no obs-text).
Instances For
ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E ; ASCII-only variant (no obs-text).
Instances For
etagc = "!" / %x23-7E ; ASCII-only variant (no obs-text).
Instances For
OWS = *( SP / HTAB ) (character class only)
Instances For
BWS = OWS (character class alias)
Instances For
obs-text = %x80-FF (and higher Unicode scalar values in this library's Char model).
Instances For
reason-phrase character class: HTAB / SP / VCHAR ; ASCII-only variant (no obs-text).
Reference: https://httpwg.org/specs/rfc9110.html#reason.phrase
Instances For
Checks if a character is a hexadecimal digit (0-9, a-f, or A-F).
Instances For
Checks if a byte is a hexadecimal digit (0-9, a-f, or A-F).
Instances For
Checks if a byte is an alphanumeric digit (0-9, a-z, or A-Z).
Instances For
Checks whether c is an ASCII alphanumeric character.
Instances For
Checks if a character is valid after the first character of a URI scheme.
Valid characters are ASCII alphanumeric, +, -, and ..
Instances For
Checks if a character is valid for use in a domain name. Valid characters are ASCII alphanumeric, hyphens, and dots.
Instances For
Checks if a byte is an unreserved character according to RFC 3986. Unreserved characters are: alphanumeric, hyphen, period, underscore, and tilde.
Instances For
Checks if a byte is a sub-delimiter character according to RFC 3986.
Sub-delimiters are: !, $, &, ', (, ), *, +, ,, ;, =.
Instances For
Checks if a byte is a valid path character (pchar) according to RFC 3986.
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
Note: The percent-encoding (pct-encoded) is handled separately by isEncodedChar,
so this predicate only covers the non-percent characters.
Instances For
Checks if a byte is a valid character in a URI query component according to RFC 3986.
query = *( pchar / "/" / "?" )
Instances For
Checks if a byte is a valid character in a URI fragment component according to RFC 3986.
fragment = *( pchar / "/" / "?" )
Instances For
Checks if a byte is a valid character in a URI userinfo component according to RFC 3986.
userinfo = *( unreserved/ sub-delims / ":" )
Note: It avoids the pct-encoded of the original grammar because it is used with Encoding.lean
that provides it.
Instances For
Checks if a byte is a valid character in a URI query component,
excluding the typical key/value separators & and =.
Inspired by query = *( pchar / "/" / "?" ) from RFC 3986,
but disallows & and = so they can be treated as structural separators.