9 Commits
Author SHA1 Message Date
Clinton Nkwocha 0d92bf6b08 Enable strict concurrency (#53)
Motivation:

To catch potential data races at build time.

Modifications:

- Enable strict concurrency in Package.swift.
- Add `Sendable` conformance to `StructuredFieldType`.
- Swap
[concurrency-unsafe](https://github.com/swiftlang/swift/issues/66213)
`CommandLine.arguments` for `ProcessInfo.processInfo.arguments`.

Result:

Strict concurrency adoption.
2024-12-05 12:16:11 +01:00
Clinton Nkwocha c2e79ce44c [RFC 9651] Add support for Display String type to RawStructuredFieldValues (#43)
Motivation:

RFC 9651 added the Display String Structured Type.

Modifications:

Implement the parser and serializer for Display String in the RawStructuredFieldValues module.

Result:

The RawStructuredFieldValues module will support the Display String type.
2024-11-22 18:11:50 +00:00
Rick Newton-Rogers 8b35bf45bf Migrate to GitHub Actions (#42)
Migrate CI to use GitHub Actions.

Motivation:

To migrate to GitHub actions and centralised infrastructure.

Modifications:

Changes of note:
* Adopt swift-format using rules from SwiftNIO
* Remove scripts and docker files which are no longer needed

Result:

Feature parity with old CI.
2024-10-30 13:20:20 +00:00
Clinton Nkwocha b0bf94fb2d [RFC 9651] Add support for Date type to RawStructuredFieldValues (#41)
Motivation:

[RFC 9651](https://www.ietf.org/rfc/rfc9651.html) added the Date Structured Type.

Modifications:

- Implement the parser and serializer for Date in the RawStructuredFieldValues module.

Result:

The RawStructuredFieldValues module will support the Date type.
2024-10-28 14:01:46 +00:00
Clinton Nkwocha f069b10a87 [RFC 9651] Implement adjustments for backward compatible update (#40)
Motivation:

`swift-http-structured-headers` has to be updated to [RFC 9651](https://www.ietf.org/rfc/rfc9651.html). And it will be convenient for users to have this update as a SemVer minor.

Modifications:

- Deprecate the `BareItem` type and replace it with `RFC9651BareItem`, retaining existing behaviours. Updates for the new RFC will be based on `RFC9651BareItem`.

Result:

The library can be updated to the new RFC in a backward-compatible manner.
2024-10-23 10:56:35 +01:00
Cory Benfield 27e163f96a Rename a number of types and modules. (#13)
Motivation:

In general we should try to be specific about what we're referring to.
"Structured headers" is not really an accurate description of what this
module works with: "Structured Header Field Values", or "Structured
Field Value" is usually better. To that end this change adjusts our
naming to be closer to what we want. It also changes our module names to
prioritise the use of the Codable-based one.

Modifications:

- Renamed CodableStructuredHeaders to StructuredFieldValues.
- Renamed StructuredHeaders to RawStructuredFieldValues.
- Renamed a number of types from Field to FieldValue.
- Renamed a number of types from Header to Field or FieldValue.
- Renamed some functions along the above lines.

Result:

Better and more consistent terminology will be used.
2021-07-02 11:48:41 +01:00
Cory Benfield b2ea94c173 Remove unnecessary genericism and generic constraints.
Motivation:

Early on in the design of Structured Headers I made a conscious effort
to try to avoid transforming types in the low-level API. This design was
built on the assumption that strings, tokens, and some other data types
could be built entirely as slices of the backing data.

Unfortunately, this isn't true: because of the need to escape chars in
Strings, it became necessary to start using more complex types in Item.
Eventually, we ended up in a place where the only field in Item that
actually stored backing data was `.undecodedByteSequence`.

This field forced almost the entire set of types in the
StructuredHeaders module to be generic, just for the sake of carrying
this one slice type around. This prevented powerful optimisations,
bloated code size, and forced additional unnecessary heap allocations.
It also forced us to constrain the types used in the parser to those
where the subsequence type was Hashable, which excluded some really
important types (like `String.UTF8View`).

Fundamentally, this genericism was hurting more than it helped at this
point, so I bit the bullet and replaced the slice type with `String` for
`undecodedByteSequence`. This led to a huge cascading removal of generic
type parameters for a wide range of types, as well as the removal of the
"must have hashable subsequence" constraints on the parser data type.
This lifts an enormous amount of complexity out of the module at the
extremely minor cost of forcing an allocation whenever we have a lot of
undecoded binary data: not a huge cost, in my view, and well worth what
we got back in return.

Modifications:

- Remove generic type parameter in BaseItem.
- Remove generic types everywhere else.
- Remove hashable constraint.

Result:

Better, faster, simpler code.
2020-08-28 16:42:42 +01:00
Cory Benfield 3f73125a0d Apply formatting 2020-07-17 10:06:44 +01:00
Cory Benfield 31a8b1658f Define simple example CLI tool 2020-07-16 10:25:52 +01:00