💧 A server-side Swift HTTP web framework.
Consistently use the value from X-Request-Id
as the request's ID when present by @baarde in #3117
Changes
This PR ensures that the Request’s
id
and the value of the logger’srequest-id
value are the same.Motivation
The Request’s
id
property was added in #2964 to expose therequest-id
identifier used for logging.#3072 changed this behavior. The
request-id
identifier is now set:
- to the value from the
X-Request-Id
header, when the header is present,- to a random identifier, when the header is absent.
Having two different identifiers is confusing. So, this PR reconciles the two values.
History
The first version of this PR allowed the two identifiers to differ when the
X-Request-Id
header is present, in order to maintain the original semantics of theid
property.
Thanks to the reviewers for their help:
Full Changelog: https://github.com/vapor/vapor/compare/4.89.1...4.89.2
Fix encoding and decoding of HTTPHeaders by @gwynne in #3116
The
Codable
conformance Vapor adds to theHTTPHeaders
type now correctly handles cases where more than one header with the same name (such asSet-Cookie
) is present, for both encoding and decoding.The previous encoding format is still recognized for decoding, so that existing serialized data can be safely read.
Full Changelog: https://github.com/vapor/vapor/compare/4.89.0...4.89.1
Add fully async entrypoints by @gwynne in #3114
Pretty much what it says on the tin. Use the new
execute()
API instead ofrun()
, and/orstartup()
instead ofstart()
.
Thanks to the reviewers for their help:
Full Changelog: https://github.com/vapor/vapor/compare/4.88.0...4.89.0
Bring back AsyncCommands by @marius-se in #3109
Brings async commands back by adding a new property
asyncCommands
toApplication
.
Full Changelog: https://github.com/vapor/vapor/compare/4.87.1...4.88.0
General warnings and tests cleanup by @gwynne in #3107
These changes fix almost all of the extant warnings in Vapor, and clean up some issues in the tests, which can now run fully parallelized. There are no functional changes.
Full Changelog: https://github.com/vapor/vapor/compare/4.87.0...4.87.1
Add public initializer for XCTHTTPRequest
by @hsharghi in #3106
Add public initializer for
XCTHTTPRequest
This PR will fix https://github.com/vapor/vapor/issues/3105Add public initializer for
XCTHTTPRequest
Full Changelog: https://github.com/vapor/vapor/compare/4.86.2...4.87.0
Make Async Request Body actually work by @0xTim in #3096
The existing implementation of adding an
AsyncSequence
toRequest.Body
had two issues:
- it didn’t ensure code was being called from the correct event loop which broke
Sendable
guarantees and was unsafe- it would hit a precondition failure in the implementation if backpressure was triggered because the initial state was not accounted for
This fixes that
Thanks to the reviewers for their help:
Full Changelog: https://github.com/vapor/vapor/compare/4.86.1...4.86.2
Create a thread pool of System.coreCount rather than 64 when initializing an Application by @dfed in #3092
Following this recommendation, this PR simply changes the default number of cores when initializing an
Application
from 64 to the current number of cores.This means that initializing an
Application
with default arguments now spins up 2x the number of threads as cores on device. We’ll createSystem.coreCount
threads when instantiating thethreadPool
, and anotherSystem.coreCount
threads when we instantiate theeventLoopGroup
.2x
System.coreCount
is still way better thanSystem.coreCount + 64
on older devices, so while this PR does not directly address #3003, it does reduce total thread usage oninit
.
Full Changelog: https://github.com/vapor/vapor/compare/4.86.0...4.86.1
Make Request Sendable by @0xTim in #3093
Final stage of Vapor’s
Sendable
journey asRequest
is nowSendable
.There should be no more Sendable warnings in Vapor, even with complete concurrency checking turned on.
Thanks to the reviewers for their help:
Full Changelog: https://github.com/vapor/vapor/compare/4.85.1...4.86.0
Remove Sendable requirements on Authenticatable by @0xTim in #3095
Removes the requirement for
Authenticatable
types to beSendable
which was causing issues with Fluent models (and any reference types) and wasn’t solvable in a non-breaking way.This uses an unsafe box to wrap the
Authenticatable
types which removes compiler checking on usage of the box but should not be an issue due to the way Vapor’s auth is implemented
Full Changelog: https://github.com/vapor/vapor/compare/4.85.0...4.85.1