def Read.extension

bend-trace-context@0.2.0.0 · trace_context.bend:2858

import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext
import Base

2858# What may follow the flags of a later version: the end of the value, or a
2859# dash that starts fields this version does not know. Those fields are not
2860# read (W3C 3.2.4: "Vendors MUST NOT parse or assume anything about unknown
2861# fields"), except that a control character in them is refused with
2862# ControlCharacter at its offset: no field value may hold one (RFC 9110,
2863# section 5.5), and a value forwarded unchanged must not end a message's
2864# field. Any other character than a dash at offset 55 is ExpectedSeparator.
2865def Read.extension(rest: String) -> Result<&2, &2, Error, Unit>:
2866  match rest:
2867    case SNil{}:
2868      Done{Unit{}}
2869    case SCon{char, tail}:
2870      do Result<&2, &2, Error, Unit>:
2871        unknown : String <- Parse.separator_result(tail, Char.is_eq(char, '-'), 55n)
2872        Read.clean(Text.control.go(unknown, 56n, None{}))

Uses (11)

Used by (1)