Commits on Dec 6, 2019
Motivation: In some cases you only expect (or care about) a single value for a header. However, getting this value without allocating an array or traversing the whole array requres using first(where:) provided by Sequence. This is not very ergonomic as it requires users to do the case-insensitive comparison and then exctact the value from the HTTPHeaders. Additionally, users cannot use NIO's case insensitive ASCII comparison. Modifications: - Provide a first(name:) method on HTTPHeaders which returns the value from the first header whose name is a case insentive match of the subscript parameter. Result: It's easier to get the first value from HTTPHeaders matching a given name.
…SetOnMultipleThreads (#1295) Motivation: testThreadSpecificDoesNotLeakIfThreadExitsWhilstSetOnMultipleThreads was periodically crashing with a SIGSEGV. Modifications: Remove unnecessary weak var, wait on semaphone instead of weak var becoming nil. Result: Less flaky test.
Commits on Dec 2, 2019
Commits on Nov 27, 2019
Motivation: ByteBufferView isn't a mutable collection, but it probably should be. Modifications: - Add `copyBytes(at:to:length)` to `ByteBuffer` to copy bytes from a readable region of a buffer to another part of the buffer - Conform `ByteBufferView` to `MutableCollection`, `RangeReplaceableCollection` and `MutableDataProtocol` - Add an allocation counting test Result: `ByteBufferView` is now mutable.
Commits on Nov 14, 2019
Nov 14, 2019
Motivation: Using the single test argument with the run-nio-alloc-counter-tests.sh does not work as expected as the given test would just replace the first test in the list. Modifications: Replace the tests to run with a single-element array containing the test provided as an argument. Result: - A single test can be run when specified as a command line arg.
Commits on Sep 13, 2019
Motivation: I ran across a case in a test where `HTTPResponseStatus(statusCode: 418)` unexpectedly returned a `.custom` response status. Modifications: - Add a missing `case` for creating a status from `418` - Shuffled some of cases around so that they are correctly listed in the correct 2xx, 3xx, 4xx etc. sections Result: - `HTTPResponseStatus(statusCode: 418)` now returns `.imATeapot`
Commits on Sep 10, 2019
Motivation: When dealing with `Result` types and promises it is inconvenient having to switch over the result in order to succeed or fail a promise. Modifications: - Allow promises to be completed with a `Result<Value, Error>` directly. - Added tests. Result: Promises are easier to fulfill with `Result` types.
Commits on Jul 4, 2019
* Check jq is available before checking API breakages Motivation: If jq wasn't installed the API breakage script would erronesouly say that there were no breaking API changes. That's pretty bad. Modifications: Check jq is available before running the check. Updated the usage message to specify that a Swift 5.1+ toolchain is required. Result: More correctness.
Commits on Jun 5, 2019
Motivation: NIO doesn't offer any tips of on how to write performant code. After discussing with @weissi we decided it would be useful to gather and document some useful tips and tricks. Modifications: Started an optimization tips document. Result: Easier for NIO users to write performant code.
Commits on Jun 4, 2019
Commits on May 16, 2019
* Allow adding a sequence of headers to HTTPHeaders Motivation: When combining two collections of headers, adding each pair one-by-one using add(name:value:) can cause multiple unnecessary reallocations of the underlying array. Modifications: Provide two additional add methods to HTTPHeaders: one to add a sequence of name/value pairs and another to add the headers from another HTTPHeaders, both of which use `append(contentsOf:)` on the underlying array to avoid additional reallocations. Result: Fewer reallocations when adding multiple headers. * Fix incorrect documentation, make add<S: Sequence>(contentsOf:) @inlineable * Reserve capacity and add sequentially instead of using append(contentsOf:) * Add tests and missing @usableFromInline
Commits on Feb 6, 2019
Commits on Feb 1, 2019