def header

bolt@1.27.0.0 · src/lsp/frame.bend:312

import bolt@1.27.0.0/src/lsp/frame.bend as Frame
import Base

312# the header block read up to its blank line: Content-Length, and the bytes
313# after; not whole yet when the blank line has not come
314def header(bs: List<&2, U32>, line: List<&2, U32>, len: List<&2, Digit>) -> Head:
315  match bs line:
316    case Nil{} l:
317      NoHead{}
318    case Con{10, t} Nil{}:
319      Head{len, t}
320    case Con{10, t} l:
321      header(t, [], line_len(l, len))
322    case Con{13, t} l:
323      header(t, l, len)
324    case Con{c, t} l:
325      header(t, c <> l, len)

Uses (8)

Used by (1)