def packed.chunk.ready.is

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

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

47# a chunk of k octets from d, ready when its CRLF follows them
48def packed.chunk.ready.is(b: Bytes.Bytes, +d: U32, +k: U32,
49  acc: List<&1, Bytes.Bytes>, ready: Bool,
50  go: Bytes.Bytes -> U32 -> List<&1, Bytes.Bytes> -> Parts) -> Parts:
51  match ready:
52    case False{}:
53      Bad{Http.chunk.short()}
54    case True{}:
55      packed.chunk.take(Bytes.slice(b, d, k), (d + k + 2 : U32), acc, go)

Uses (9)

Used by (1)