def packed.body

emerging-ezhttp@0.21.0.0 · src/packed.bend:138

import emerging-ezhttp@0.21.0.0/src/packed.bend as Packed
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
import emerging-ezhttp@0.21.0.0/src/http.bend as Http

138# the octets after the final head, as its framing says
139def packed.body(st: U32, hs: List<&2, Http.Header>, reason: String,
140  f: Http.Frame, b: Bytes.Bytes, +q: U32, +len: U32) -> Got:
141  match f:
142    case Http.Bare{}:
143      Got{st, hs, reason, Bytes.new(0)}
144    case Http.Sized{+n}:
145      packed.sized(st, hs, reason, b, q, n,
146        Nat.is_lt(U32.to_nat((len - q : U32)), n))
147    case Http.Chunked{}:
148      packed.chunked(st, hs, reason,
149        packed.chunks(U32.to_nat((len - q : U32)), b, q, len, []))
150    case Http.Closed{}:
151      Got{st, hs, reason, packed.copy(b, q, (len - q : U32))}

Uses (15)

Used by (1)