def step.need.of
import emerging-ezhttp@0.22.0.0/src/step.bend as Stepimport 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")))))}