New Collection to hold fragmented and non-fragemented Structured Fields
Motivation:
A representation of the raw, unparsed structured field value (Structured Field Values for HTTP, draft-ietf-httpbis-header-structure-latest). Lists, Dictionaries and Strings can have their members split across multiple lines inside a header or trailer section, as per Soection 3.2.2 of [RFC7230]; for example, the following are equivalent:
Example-Hdr: foo bar
Example-Hdr: foo Example-Hdr: bar
This Collection stores the raw, unparsed represention of a potentially fragmented StructuredField inserting a defined separator charater. This allows a parser to ensure that a split StructuredField is permissible and also reject SF values where the spec defines such splitting as optional.
Modifications:
Added RawStructuredField struct (along with unit test) implementing the RandomAccessCollection protool and therefore compatibile with the existing API of StructuredFieldParser.
Updated unit test for StructuredFieldParser to use new collection.
Result:
StructuredFieldParser can be created by passing a RawStructuredField as follows:
let sf = RawStructureField(fragments: raw) let StructuredFieldParser(sf)