8 Commits

Author SHA1 Message Date
Tanner
0b9eb87b22
Skip HTTPResponseCompressor logic if response is 204 (no content) (#105)
* Skip HTTPResponseCompressor logic if response is 204 (no content)

* update test manifests

* use mayHaveResponseBody
2020-08-14 17:10:00 +01:00
Karl
f700f5b355
Rename startsWithSameUnicodeScalars -> startsWithExactly, switch to comparing UTF8 bytes. (#104) 2020-08-05 10:47:25 +01:00
gkaindl
d525d3bbd1
Ensures gzip/deflate-compressed responses are properly finalized in all cases (#100)
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.
2020-07-28 17:33:35 +01:00
Adam Fowler
020e322a65
Added NIOHTTPRequestCompressor to compress requests (#88)
* Added NIOHTTPRequestCompressor to compress requests

Also moved common code from request and response compressor into separate NIOHTTPCompression enum.

* Updates after comments from @weissi

Also reinstated public enum HTTPResponseCompressor.CompressionError

* algorithms are now let not var

* Catch situation where head is flushed before anything else comes through

Content-encoding was not being set
Added additional tests for header values

* Added documentation around 5 bytes added to buffer size and add them

* Renaming NIOHTTPCompressionSetting to NIOCompression

Also
NIOHTTPCompressionSetting.CompressionAlgorithm is NIOCompression.Algorithm
NIOHTTPCompressionSetting.CompressionError is NIOCompression.Error
Algorithm now conforms to Equatable

* Forgot to run generate_linux_tests

* Fix typos
2020-04-30 17:28:49 +01:00
Artem Redkin
ed97628fa3 fix NIO 2.9.0 deprecations (#61)
Motivation:

Usage of deprecated methods is bad.

Modification:

Fix usage of deprecated methods.

Result:

Fewer warnings.
2019-10-23 17:23:34 -07:00
Johannes Weiss
5b67140545
make HTTPResponseCompressor removable (#33)
Motivation:

HTTPResponseCompressor is trivially removable, so mark it.

Modifications:

make HTTPResponseCompressor implement RemovableChannelHandler

Result:

HTTPResponseCompressor can be removed
2019-03-08 18:32:08 +00:00
Johannes Weiss
b972d1b03d
update to latest NIO (#36)
Motivation:

code needs to compile to be good

Modifications:

make code compile

Result:

code compiles
2019-03-08 18:10:54 +00:00
Johannes Weiss
7a3e42a40f
move HTTPResponseDecoder to swift-nio-extras (#28)
Motivation:

HTTPResponseDecoder needs to incumbate, so move to nio-extras.

Modifications:

move all the code here.

Result:

incubation can begin
2019-03-05 17:59:29 +00:00