Documentation

Std.Internal.Http.Internal.Char

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.

@[inline]

Checks if a character is ASCII (Unicode code point < 128).

Equations
Instances For
    @[inline]

    Checks if a byte represents an ASCII character (value < 128).

    Equations
    Instances For
      @[inline]

      Checks if a byte is a decimal digit (0-9).

      Equations
      Instances For
        @[inline]

        Checks if a byte is an alphabetic character (a-z or A-Z).

        Equations
        Instances For
          @[inline]

          vchar = %x21-7E ; Visible (printing) ASCII characters.

          Equations
          Instances For
            @[inline]

            qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E ; ASCII-only variant (no obs-text).

            Equations
            Instances For
              @[inline]

              quoted-string body character class: ( qdtext / quoted-pair payload ) in ASCII-only mode.

              Equations
              Instances For
                @[inline]

                field-vchar = VCHAR ; ASCII-only variant (no obs-text).

                Equations
                Instances For
                  @[inline]

                  ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E ; ASCII-only variant (no obs-text).

                  Equations
                  Instances For
                    @[inline]

                    etagc = "!" / %x23-7E ; ASCII-only variant (no obs-text).

                    Equations
                    Instances For
                      @[inline]

                      OWS = *( SP / HTAB ) (character class only)

                      Equations
                      Instances For
                        @[inline]

                        BWS = OWS (character class alias)

                        Equations
                        Instances For
                          @[inline]

                          RWS = 1*( SP / HTAB ) (character class is identical to ows)

                          Equations
                          Instances For
                            @[inline]

                            obs-text = %x80-FF (and higher Unicode scalar values in this library's Char model).

                            Equations
                            Instances For
                              @[inline]

                              Checks if a byte is a hexadecimal digit (0-9, a-f, or A-F).

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[inline]

                                Checks if a byte is an alphanumeric digit (0-9, a-z, or A-Z).

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[inline]

                                  Checks whether c is an ASCII alphanumeric character.

                                  Equations
                                  Instances For
                                    @[inline]

                                    Checks if a byte is an unreserved character according to RFC 3986. Unreserved characters are: alphanumeric, hyphen, period, underscore, and tilde.

                                    Equations
                                    Instances For
                                      @[inline]

                                      Checks if a byte is a sub-delimiter character according to RFC 3986. Sub-delimiters are: !, $, &, ', (, ), *, +, ,, ;, =.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        @[inline]

                                        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.

                                        Equations
                                        Instances For
                                          @[inline]

                                          Checks if a byte is a valid character in a URI query component according to RFC 3986. query = *( pchar / "/" / "?" )

                                          Equations
                                          Instances For
                                            @[inline]

                                            Checks if a byte is a valid character in a URI fragment component according to RFC 3986. fragment = *( pchar / "/" / "?" )

                                            Equations
                                            Instances For
                                              @[inline]

                                              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.

                                              Equations
                                              Instances For
                                                @[inline]

                                                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.

                                                Equations
                                                Instances For