def phase.after
bend-kit-http@0.38.5.0 · http.bend:6031
import bend-kit-http@0.38.5.0/http.bend as Http
import Base
import bend-kit-time@0.3.0.0/time.bend as Time
6031def phase.after(+settings: Limits, +now: Time.Duration, +phase: Phase, t: Turn) -> Turn & Phase:
6032 Limits{max, cap, hm, bm, im, wm} = settings
6033 Phase{+kind, until} = phase
6034 match t:
6035 case TurnMore{sv, cont}:
6036 match sv:
6037 case SvHead{buf}:
6038 (TurnMore{SvHead{buf}, cont}, Bool.pick(Phase, U32.is_zero(kind), phase.new(1, hm, now), phase))
6039 case SvLen{req, v11, left, parts}:
6040 (TurnMore{SvLen{req, v11, left, parts}, cont}, Bool.pick(Phase, U32.is_eq(kind, 2), phase, phase.new(2, bm, now)))
6041 case SvChunk{req, v11, n, st, parts}:
6042 (TurnMore{SvChunk{req, v11, n, st, parts}, cont}, Bool.pick(Phase, U32.is_eq(kind, 2), phase, phase.new(2, bm, now)))
6043 case TurnReq{req, rest, v11}:
6044 (TurnReq{req, rest, v11}, phase)
6045 case TurnFail{+status}:
6046 (Bool.pick(Turn, U32.is_zero(kind) && U32.is_eq(status, 408), TurnClose{}, TurnFail{status}), phase)
6047 case TurnClose{}:
6048 (TurnClose{}, phase)
6049 case TurnInputFailed{operation, code, message}:
6050 (TurnInputFailed{operation, code, message}, phase)