Motivation:
Swift 6.0 is no longer supported, we should bump the tools version and
remove it from our CI.
Modifications:
* Bump the Swift tools version to Swift 6.1
* Remove Swift 6.0 jobs where appropriate in main.yml, pull_request.yml
Result:
Code reflects our support window.
### Motivation:
Swift 5.10 is no longer supported, we should bump the swift-tools
version.
### Modifications:
* Update Swift tools version to 6.0
### Result:
Code reflects our support window.
Update StructuredFieldValueParser to add missing visionOS guard matching
the guards on the called API. This was causing failures to compile for
visionOS
Update FieldParser.swift availability guard for
```
String(unsafeUninitializedCapacity: unescapedBytes.count)
```
which is only available on Mac Catalyst 14.0 or later
Motivation:
swift-http-structured-headers has been updated to [RFC
9651](https://www.ietf.org/rfc/rfc9651.html).
Modifications:
- Update documentation.
Result:
An up-to-date documentation.
Co-authored-by: Cory Benfield <lukasa@apple.com>
Motivation:
[RFC 9651](https://www.ietf.org/rfc/rfc9651.html) permits serializing an
integer in the range of -999,999,999,999,999 to 999,999,999,999,999
inclusive ([Section
4.1.4-2.1.1](https://www.ietf.org/rfc/rfc9651.html#section-4.1.4-2.1.1)).
As `RFC9651BareItem` takes values `integer` or `date` with an associated
value of type `Int`, that range is implicitly more constrained on 32-bit
platforms to a subset range of `Int32.min` to `Int32.max` inclusive.
Modifications:
- Adjust `RFC9651BareItem` to take values `integer` or `date` with an
associated value of type `Int64` instead, which is sufficient for the
permitted range.
Result:
Compatibility for the Integer and Date Structured Types on 32-bit
platforms.
Motivation:
The parser and serializer for the Display String type have been
implemented. The high-level encoder and decoder should follow.
Modifications:
Implement the encoder and decoder for Display String.
Result:
The StructuredFieldValues module will support the Display String type.
---------
Co-authored-by: Cory Benfield <lukasa@apple.com>
Motivation:
The parser and serializer for the Date type has been implemented. The high-level encoder and decoder should follow.
Modifications:
- Implement the encoder and decoder for Date.
Result:
The StructuredFieldValues module will support the Date type.
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.
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.
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.
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.
Motivation:
We no longer support compilers older than 5.3 (or indeed older than
5.6), so we don't need compiler guards for old ones.
Modifications:
Remove fallback for old compilers.
Result:
Easier to understand code
* Remove Swift 5.5 Dockerfile
Motivation:
Swift 5.5 is no longer supported.
Modifications:
Remove Swift 5.5 Dockerfile
Result:
Swift 5.5 support fully removed
* Remove SHSendable
---------
Co-authored-by: Cory Benfield <lukasa@apple.com>
Motivation
Documentation is nice, and we can help support users by providing useful
clear docs.
Modifications
Add Docc to 5.6 and later builds
Make sure symbol references work
Add overview docs
Result
Nice rendering docs
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.
* fix formatting so that sanity script passes
motivation: consistent formatting as prep for OSS
changes: run swiftformat to align formatting
* dont use TSAN on 18.04
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.
Motivation:
Right now we disambiguate the multiple top-level SH types by using three
separate entry points on the encoder/decoder. This isn't great: it
forces that information to be known statically at compile time, making
it much harder to write generic APIs that use structured header fields.
Modifications:
- Provide a new protocol, `StructuredHeaderField`, that must be used for
the top-level `Codable` object.
- Provide `StructuredHeaderFieldType` to communicate the types of
structured header fields.
- Remove the multiple entry points.
- Update the tests.
Result:
Types will encode what kind of structured header field they are.
Motivation:
We had a proliferation of decode/encode methods that required users to
tell us how to encode their structured header field. This is a bit
annoying for two reasons: firstly, it requires users to encode this
piece of information separately from their header field; secondly, it
makes it very hard to offer a generic interface to load something as a
structured header field!
Modifications:
- Add a new StructuredHeaderField protocol that refines Codable and
expresses what type of header field is used.
- Remove the fancy encode/decode methods.
Result:
Simpler interfaces.
Motivation:
A number of the changes in the code for running on Linux
were not validated ahead of time, and broke the build.
Modifications:
- Correct the spelling of Glibc
- Modified string initialization on non-Darwin platforms
Results:
Builds and passes tests on Linux