Documentation

Hale.Http2.Network.HTTP2.HPACK.Table

@[reducible, inline]

A header field is a name-value pair of strings. $$\text{HeaderField} = \text{String} \times \text{String}$$

Equations
Instances For

    The HPACK static table as defined in RFC 7541 Appendix A. Index 1-based, containing 61 pre-defined header fields.

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

      Size of the static table. Always 61.

      Equations
      Instances For

        Look up an entry in the static table by 1-based index. $$\text{staticLookup}(i) = \text{staticTable}[i-1]$$ for $1 \leq i \leq 61$. Returns none for out-of-range indices.

        Equations
        Instances For

          The HPACK dynamic table. Entries are stored most-recent-first. The table has a maximum size in octets, and entries are evicted from the end (oldest) when the size would exceed the maximum.

          Size of an entry: name.length + value.length + 32 (RFC 7541 Section 4.1).

          • entries : Array HeaderField

            Entries stored most-recent-first.

          • currentSize : Nat

            Current size in octets.

          • maxSize : Nat

            Maximum size in octets (from SETTINGS_HEADER_TABLE_SIZE).

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

              Calculate the HPACK entry size per RFC 7541 Section 4.1. $$\text{entrySize}(n, v) = |n| + |v| + 32$$

              Equations
              Instances For

                Create an empty dynamic table with the given maximum size. $$\text{empty}(m) = \{ \text{entries} = [], \text{currentSize} = 0, \text{maxSize} = m \}$$

                Equations
                Instances For
                  @[inline]

                  Get the number of entries in the dynamic table.

                  Equations
                  Instances For

                    Look up an entry by 0-based index (0 = most recent). $$\text{lookup}(dt, i) = dt.\text{entries}[i]$$

                    Equations
                    Instances For

                      Insert a new entry at the front of the dynamic table. Evicts old entries as needed to maintain the size invariant. If the entry itself is larger than maxSize, the table is emptied.

                      $$\text{insert}(dt, n, v) = \text{evict}(\{n:v\} :: dt.\text{entries})$$

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

                        Resize the dynamic table to a new maximum size. Evicts entries if needed. $$\text{resize}(dt, m) = \text{evict}(dt, m)$$ with updated maxSize.

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

                          Find a header field in the dynamic table. Returns the 0-based index if found. Searches for exact (name, value) match first, then name-only match.

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

                            Look up a header field by HPACK index (1-based, static table first, then dynamic). $$\text{indexLookup}(dt, i) = \begin{cases} \text{staticTable}[i-1] & \text{if } 1 \leq i \leq 61 \\ \text{dt.entries}[i-62] & \text{if } i > 61 \end{cases}$$

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

                              Find a header field in the combined static + dynamic tables. Returns (index, exactMatch) where index is 1-based HPACK index.

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