def step.need.of

emerging-ezhttp@0.22.0.0 · src/step.bend:113

import emerging-ezhttp@0.22.0.0/src/step.bend as Step
import Base
import emerging-ezhttp@0.22.0.0/src/http.bend as Http

113# octets a request needs in all once its head has ended: the head, its blank
114# line and the octets its Content-Length names (0 when it names none)
115def step.need.of(c: Http.Cut) -> Maybe<&2, Nat>:
116  match c:
117    case Http.NoCut{}:
118      None{}
119    case Http.Cut{+before, after}:
120      Some{Nat.add(Nat.add(String.length(before), 4n),
121        step.clen(Http.digits.read(Http.first(
122          Http.head.values(String.lines(before), "content-length")))))}

Uses (10)

Used by (1)