Motivation:
Certain malformed q-values can trigger a crash because they don't
validate that a string split results in the expected number of parts.
Modifications:
- validate that the number of split parts is as expected, return a
q-value of zero otherwise (i.e. "not acceptable")
Result:
Safer code
### Motivation:
Relying on the system zlib causes issues if that library (or its
headers) doesn't ship with the system.
### Modifications:
Vendor it.
### Result:
- Fewer dependencies.
- Binary size increase negligible. The _sum of the debug builds_ of all
`.o` files is less than 200kB. A linked release build will make this
even smaller:
```
$ du -k .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/*.o
12 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/adler32.c.o
12 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/crc32.c.o
60 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/deflate.c.o
16 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/inffast.c.o
40 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/inflate.c.o
16 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/inftrees.c.o
40 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/trees.c.o
8 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/zutil.c.o
```
Co-authored-by: Johannes Weiss <johannes@jweiss.io>
Motivation:
The latest NIO release deprecated a number of APIs and added more
Sendable contraints.
Modifications:
- Use sync APIs where possible
- Use `_deprecated` but not `@deprecated` NIOFileHandle API
- Stop using NIOAny
Result:
No warnings
### 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.
* Added support for conditional response compression
* Updated expectations to be fulfilled via a defer
* Updated compression response predicate to return an intent enum rather than a boolean
Motivation:
SwiftNIO periodically drops support for older Swift versions. Now that
5.7 has been released, 5.4 will be dropped.
Modifications:
- Remove 5.4 specific Package.swift and docker-compose
- Update the 5.7 docker-compose to use the released 5.7 and move from
focal (2004) to jammy (2204)
- Update docs
Results:
Minimum Swift version is 5.5
Motivation:
With NIO 2.32.0 we broke the core NIO module up into modules that split
apart the POSIX layer and the core abstractions. As a result, this
package no longer needs to express a hard dependency on the POSIX layer.
Modifications:
- Rewrote imports of NIO to NIOCore.
- Added NIOEmbedded and NIOPosix imports where necessary in tests.
- Extended soundness script to detect NIO imports.
- Note that the main modules still depend on NIO, which is necessary
for backwards-compatibility reasons. This dependency is unused.
Result:
No need to use NIOPosix.
Motivation:
Previously, when using the response compressor, doing a flush() right before finishing the
response data would cause the final compression chunk to be omitted. Some strict decompressors
(such as gzip or the zlib functionality exported in nodejs) would refuse to decompress the
incomplete response.
With this change, the generated compressed response is properly finalized.
Modifications:
In HTTPResponseCompressor.swift, a channel write is now also generated if no body data is
added, but a flush is required.
Result:
The response is now correct for this edge case, enabling gzip, nodejs, et al., to
decompress it without errors.
Motivation:
The test suite for some reason imported NIO as @testable which is
verboten.
Modifications:
Don't do that.
Result:
Feeling better, compatible with the upcoming NIO 2.10.1.
Motivation:
HTTPResponseCompressor is trivially removable, so mark it.
Modifications:
make HTTPResponseCompressor implement RemovableChannelHandler
Result:
HTTPResponseCompressor can be removed