104 Commits

Author SHA1 Message Date
tomer doron
a8382b8f67 update docker setup (#66)
motivation: use official docker images, fix swift 5.1 ci

changes:
* use official docker images
* include zlib1g-dev since its required for 5.1 ci
2019-10-26 02:34:18 -07:00
Johannes Weiss
f2b9696306 cleanup CI (#63) 2019-10-25 17:10:09 -07:00
Johannes Weiss
64c4d22ba5 follow general parser guidelines, even in tests (#62) 2019-10-25 01:30:08 -07: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.
1.3.1
2019-10-23 17:23:34 -07:00
Caleb Kleveter
0584020dca Gzip request decompress (#59)
### Motivation:

There will be times when a client wishes to send larger requests with gzipped bodies to save on network traffic. This PR adds a `NIOHTTPRequestDecompressor` which can be added to the server's channel pipeline so those requests are automatically inflated.

### Modifications:

- Added a `CNIOExtrasZlib_voidPtr_to_BytefPtr` C method.
- Added a `NIOHTTPRequestDecompressor` type.
- Added a `HTTPResponseDecompressorTest` test case.

### Result:

Now you don't have to manually check the `Content-Encoding` header and decompress the body on each incoming request.
1.3.0
2019-10-10 13:51:07 +01:00
Artem Redkin
16fbdf3868 extract common classes for server request decompressor (#60)
* extract common classes for server request decompressor

* review fix: make fields private and make state part of the handler

* review fixes

* review fix: reserve capacity before inflating
2019-10-08 12:23:32 +01:00
Artem Redkin
863c6b55c6 add http client decompressor (#56)
### Motivation:
Many HTTP servers can send compressed responses to clients and it would be a great feature for `AsyncHTTPClient` to support it. But since we want to minizime usage of unsafe APIs in SSWG projects, I propose to consolidate interfacing with zlib to `nio-extras` since it already supports `zlib` compression.

### Modifications:
Added `HTTPResponseDecompressor` and accompanying tests

### Result:
Users (primarily `AsyncHTTPClient`) can now provide automatic response decompression support.
2019-10-02 15:39:46 +01:00
tomer doron
42643c9100 update conduct email group (#55)
motivation: use consistent email across swift server projects

changes: set conduct email address to swift-server-conduct@group.apple.com
2019-08-20 20:31:34 +01:00
Johannes Weiss
5a2fc66068
ServerQuiescingHelper: don't swallow close errors (#54)
Motivation:

ServerQuiescingHelper used to swallow close errors and it shoulnd't do
that.

Modifications:

Don't swallow close errors.

Result:

More correctness.
2019-08-07 18:05:47 +01:00
Johannes Weiss
66f9a509ed
use B2MD verifier (#52)
Motivation:

Use B2MDVerifier for the B2MDs in NIOExtras. Already found one bug,
separetely fixed in #51.

Modifications:

Write a basic validation test for all B2MDs.

Result:

Better test coverage.
1.2.0
2019-05-28 11:28:59 +01:00
George Barnett
3a9ddcaf3e Update target versions in podspec generation script (#50)
Motivation:

The script to generate a podspec used the minimum platform versions for
NIOTS instead of NIO.

Modifications:

Lower the minimum platform version to match those supported by NIO.

Result:

Larger Cocoapods platform support.
2019-05-22 16:42:27 +01:00
Johannes Weiss
c38fb10f50 JSONRPC framing: Content-Length (#53)
Motivation:

JSPN-RPC uses various framing methods, one is Content-Length based
framing. NIOExtras should provide encoder/decoders for this.

Modifications:

Add such codecs.

Result:

NIOExtras more useful
2019-05-13 10:37:25 -07:00
Johannes Weiss
bddf6c5d74 LineBasedFrameDecoder: tolerate drip fed \r\n (#51)
Motivation:

LineBasedFrameDecoder previously would only correctly decode \r\n as a
line-ending iff \r\n were not split apart.

Modifications:

Handle \r\n arriving apart.

Result:

more correct line splitting
2019-05-10 19:04:33 +01:00
Romain Pouclet
1d1e76cf79 Add a podspec for NIOExtras (#48)
Motivation:

https://github.com/apple/swift-nio-extras/issues/45

Modifications:

Add a podspec

Result:

Happy cocoapods users
2019-04-16 20:00:32 +01:00
Johannes Weiss
88530fd1d2 README: Add missing handlers (#47)
Motivation:

README has an overview with the handlers that NIOExtras provides, some
were missing.

Modifications:

Add the missing ones.

Result:

Better README.
2019-04-12 16:53:17 +01:00
Johannes Weiss
96e8335180
write PCAP handler (#46)
Motivation:

Especially with TLS but also without, in real production environments it
can be handy to be able to write pcap files from NIO directly.

Modifications:

add a ChannelHandler that can write a PCAP trace from what's going on in
the ChannelPipeline.

Result:

easier debugging in production
1.1.0
2019-04-12 15:08:10 +01:00
Johannes Weiss
aad5c1ca6a update the readme for NIO2 (#43)
Motivation:

Again, we had some outdated information in the README file.

Modifications:

fix the outdated info.

Result:

more accurate information.
2019-03-27 09:44:25 +00:00
Johannes Weiss
3431d30113 use Swift 5.0 release (#42) 2019-03-26 11:19:43 +00:00
Johannes Weiss
ef608e41a9
use SwiftNIO 2.0.0 (#41) 1.0.0 2019-03-26 09:16:40 +00:00
Johannes Weiss
b7a3549b63
update to latest EmbeddedChannel API (#40)
Motivation:

EmbeddedChannel's API has changed a litle bit, we should update.

Modifications:

update

Result:

code will continue to work
1.0.0-convergence.2
2019-03-22 14:00:12 +00:00
Johannes Weiss
1c39f44412
LineBasedFrameDecoder: Don't discard everything after EOF (#39)
Motivation:

LineBasedFrameDecoder discarded everything after EOF and delivered it in
the left-over bytes error. For the real world however that doesn't make
much sense, you'd want all previously received lines and only receive
the partial lines as left-overs.

Modifications:

deliver lines until there are only partial lines left, even in case of
EOF.

Result:

LineBasedFrameDecoder more useful
2019-03-21 14:55:21 +00:00
Liam Flynn
66c13a41c7 Motivation: (#38)
Fixing a broken link in the readme file.

Modifications:

A single character correction in the readme file.

Result:

Improved pedanticism and/or readability depending upon the readers perspective.
2019-03-20 11:29:40 +00:00
Johannes Weiss
7d42934f15
depend on swift-nio: 2.0.0-convergence.1 (#37)
Motivation:

to tag versions, we shouldn't depend on `.branch("master")`

Modifications:

depend on swift-nio: 2.0.0-convergence.1

Result:

ready to soon tag the first version
1.0.0-convergence.1
2019-03-08 19:17:38 +00:00
Johannes Weiss
3c1bf78a15
remove NIO1APIShims (#35)
Motivation:

NIO will be converging soon, no more API shims needed.

Modifications:

remove NIO1APIShims

Result:

no warnings.
2019-03-08 19:13:10 +00: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
f32f6cac79
enable warnings as errors (#34)
Motivation:

warnings as errors is good

Modifications:

add warnings as errors

Result:

no more warnings
2019-03-08 18:21:47 +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
45ddf6a211
LineBasedFrameDecoder: don't crash when leftovers available (#13)
Motivation:

Currently, we crash if there's any left over bytes available because
LineBasedFrameDecoder modifies cumulationBuffer in a way that is
illegal.

Modifications:

stop modifying cumulationBuffer in an illegal way

Result:

fewer crashes
2019-03-08 15:41:46 +00:00
Tanner
575263e5f1 add NIOHTTPCompression library (#31) 2019-03-05 18:32:29 +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
Johannes Weiss
be3d15ad7b update to latest NIO (#29)
Motivation:

Code broke again (mostly EmbeddedChannel.readInbound/Outbound which is
now throwing)

Modifications:

make code compile again

Result:

happy
2019-03-04 14:03:49 +00:00
Johannes Weiss
7b7fcf09be port to NIO 2 (#24)
Motivation:

NIO 2 is the new hot stuff.

Modifications:

port to NIO 2

Result:

newer, shinier
2019-02-26 13:01:48 +00:00
tomer doron
24c1e12ad2 fix docker setup for swift 5 (#27)
motivation: build on swift 5

changes:
* fix test task defition to use correct image
* remove redundant jazzy setup
2019-02-26 11:27:35 +00:00
Johannes Weiss
f7cc6c3db5
Swift 5 docker-compose stuff (#25) 2019-02-24 20:22:04 +00:00
Johannes Weiss
0dbd54199d
add RequestResponseHandler (#23)
Motivation:

Frequently, people want to terminate their pipeline with a handler that
takes in requests & a promise and on receipt of the response just
fulfill that promise.

Modifications:

- add `RequestResponseHandler`
- remove outdated of contents from README.md

Result:

more useful handlers
0.1.3
2019-01-29 15:30:24 +00:00
JovanMilenkovic
f137a8c931 Add channel handlers to debug inbound and outbound events (#22)
Motivation:

Users may want to log all of inbound and/or outbound events

Modifications:

Add DebugInboundEventsHandler and DebugOutboundEventsHandler

Result:

Users can plug additional handlers into their pipeline for default printing of events or getting a hook with relevant information for their own logging mechanism.
2019-01-21 21:10:52 +00:00
Liam Flynn
5a4a0976b3 Adds missing files to the contents list in the readme. (#21)
Motivation:
To improve the visibility of recently added files.

Modifications:
Adds 3 files to the file list in README.md.
Includes additional contributor.

Result:
Easier to see the full project contents as the readme is more accurate.
2019-01-14 14:18:18 +00:00
Liam Flynn
34a17feb83 Adds a LengthFieldPrepender class to prepend the length onto a message. (#19)
* Adds a LengthFieldPrepender class to prepend the length onto a message.
This class is a type of byte to message encoder.

Motivation:
To encode a prepended length field on data so that messages of arbitrary size can be sent.
Can work as a pair with the ‘LengthFieldBasedFrameDecoder’.

Modifications:
Added ‘LengthFieldPrepender’
Added unit tests for ‘LengthFieldPrepender’ in ‘LengthFieldPrependerTest’
Updated the linux text files by running the script.

Result:
The length can now be easily prepended to any message.
2019-01-02 18:09:05 +00:00
Johannes Weiss
292b0cf25c LengthFieldBasedFrameDecoder: work around brittle B2MD (#20)
Motivation:

ByteToMessageDecoder is extremely brittle, for example a reentrant call
into decodeLast will present the user with bytes that were previously
seen...

Modification:

Discard bytes in decodeLast

Result:

LengthFieldBasedFrameDecoder will work if close called from channelRead.
2018-12-14 15:35:25 +00:00
Liam Flynn
a9aafde504 Adds a basic length field based frame decoder class. (#17)
* Adds a basic LengthFieldBasedFrameDecoder

Motivation:
Adding a popular type of decoder that is useful in real-world situations, particularly when dealing with protocol buffers.

Modifications:
Added the decoder class, tests and linux test files.

Result:
The project now includes a basic length field based decoder which can be built upon.
Further header specification may be required but this version suits basic usage.
2018-11-27 14:30:20 +00:00
Liam Flynn
444395adf6 Renames the files for the frame decoder classes to match the class names. (#16)
* Renames the class files for the frame decoders to match the class names.

Motivation:
Neatening of the project by ensuring file names match the contained class names.

Modifications:
5 file renames, 4 of which are test files.

Result:
Ruby hooks script ran with no changes.
No breaking changes.
The project is a little neater.
2018-10-31 10:05:50 +00:00
Johannes Weiss
28154e042e empty commit
Motivation:

for administrative reasons

Modifications:

none

Result:

same as 0.1.1
0.1.2
2018-09-12 12:43:11 +01:00
Ludovic Dewailly
ad4edc8cb5 Adds a line-based frame decoder that can split received buffers on line endings. (#11)
* Adds a line-based frame decoder that can split received buffers on line endings.

Motivation:

As per https://github.com/apple/swift-nio/issues/473

Modifications:

Added a new decoder (LineBasedFrameDecoder) that splits incoming buffers on line end characters.

Result:

Received buffers will be split on line end character(s) ('\n' or '\r\n'), with these characters
stripped in the resulting buffers.
0.1.1
2018-08-06 16:43:39 +01:00
Ludovic Dewailly
abaecbd4e7 Minor change to correct which git repository developers should open pull request at. (#12)
Motivation:

Probably a hangover of using NIO's version as template.

Modifications:

Updated the repository URL where to open PR in CONTRIBUTING.md

Result:

"Please open a pull request at https://github.com/apple/swift-nio-extras"
2018-08-06 10:03:10 +01:00
Franz Busch
10e173cbed FixedLengthFrameDecoder (#9)
Provide a decoder for frames with a fixed length.

Motivation:

This was motivated by the issue https://github.com/apple/swift-nio/issues/474 as a good first issue.

Modifications:

Implemented a FixedLengthFrameDecoder as well as tests.

Result:

Users can decode fixed length frames.
2018-07-17 16:12:26 +01:00
Franz Busch
fb343c365e github templates (#10) 2018-07-14 12:06:55 +01:00
Johannes Weiß
f5512693e3 fix readme dependency (#7)
Motivation:

in SwiftPM it's either of these three formats

- from: "0.1.0"
- .exact("0.1.0")
- .upToNextMajor(from: "0.1.0")

and I messed up the last one (forgot the `from:`)

Modifications:

fixed Package.swift

Result:

recommended syntax actually works
2018-05-23 19:28:32 +01:00
Johannes Weiß
51c2dfb37b require Swift 4.1 (#6)
Motivation:

As swift-nio-extras is new, we can require Swift 4.1 which will allow us
to CI less stuff and also won't compatibility stuff for 4.0 that nobody
uses anymore.

Modifications:

require Swift 4.1

Result:

shinier
0.1.0
2018-05-23 16:32:57 +01:00
Johannes Weiß
bdd3e06759 update README: upToNextMinor & current contents (#5)
Motivation:

It's better for users to depend on `.upToNextMinor` instead of `.exact`
versions and I previously forgot to mention the quiescing helper in
the readme.

Modifications:

- mention quiescing helper in readme
- recommend to depend on this package with `.upToNextMinor`

Result:

better readme
2018-05-23 14:49:35 +01:00
Johannes Weiß
2516d61aee
add docker setup (#4)
Motivation:

We need the docker setup for CI.

Modifications:

Added docker setup. Started with swift-nio's setup and then removed
everything that we don't need (test, http, echo, integration-tests).

Result:

We can move forward doing CI.
2018-05-22 10:31:13 +01:00