Releases: vapor/vapor
4.78.0 - Allow specifying a timeout for client requests
What's Changed
Allow specifying a timeout for client requests by @ffried in #3043
Adds a
timeout
property toClientRequest
, which is forwarded toHTTPClient
byEventLoopHTTPClient
.
To use it, thebeforeSend
closure can be used:request.client.get("http://example.com") { $0.timeout = .seconds(5) }
New Contributor
This patch was released by @gwynne
Full Changelog: 4.77.2...4.78.0
4.77.2 - Update dependencies with known CVEs to the latest versions
This patch was released by @0xTim.
What's Changed
Update dependencies with known CVEs to the latest versions by @0xTim in #3038
Async HTTP Client and SwiftNIO and SwiftNIO extras have CVEs that have been patched. We still depend on versions that are vulnerable, so this updates that.
Full Changelog: 4.77.1...4.77.2
Improve error reporting for `EncodingError` and `DecodingError`
This patch was authored by @grahamburgsma and released by @0xTim.
As EncodingError
and DecodingError
both conform to LocalizedError
, error reporting uses their localizedDescription
which is just a generic error message.
So this changes the error reporting from:
The operation could not be completed. The data isn’t in the correct format.
To a description much more useful (for example):
invalidValue(inf, Swift.EncodingError.Context(codingPath: [...], debugDescription: "Unable to encode Double.inf directly in JSON.", underlyingError: nil))
Add `ContentContainer.decode(_:as:)`
Fixed drain handler call order in case of asynchronous buffer handling
This patch was authored by @salpieiev and released by @0xTim.
During request body drain each chunk of data may be handled asynchronously. This may lead to a call of handler with .end
parameter before previous call with .buffer(buffer)
finished it's execution.
For example:
- Open new file descriptor
- During
.collected
stage write ByteBuffer on disc using this file descriptor - During
.end
stage close file descriptor
This fix ensures that file descriptor won't be closed until disc write completes
Don't use UnsafeRawBufferPointer.withMemoryRebound(to:_:) before Swift 5.7.2
This patch was authored and released by @gwynne.
This API did not exist yet in Swift 5.7.0. It will now only be called in 5.7.2 or later.
(This being said, those still using Xcode 14.0.x - the only known affected version - should upgrade to 14.2 (if still running Monterey) or 14.3 (if running Ventura).)
Fix `Range: bytes=0-0` header not working properly
This patch was authored by @ptoffy and released by @0xTim.
This aims to fix the bug found in https://discord.com/channels/431917998102675485/519613337638797315/1104341522473812039, which returned a Bad Response
rather then returning the first byte of the requested content when the Range: bytes=0-0
request header was used
Improved error logging
This patch was authored and released by @gwynne.
Some kinds of errors provide additional "debug" information, which can give much more detail than the "plain" description of the error. In many cases this debug info can contain sensitive data, such as specifics about a database schema, so Vapor only uses the plain description when sending errors to clients (and in release environments, all details are suppressed).
To date, the plain description has also been used for logging errors. This can make it very difficult for developers to figure out what's going wrong with their code if the error in question only provides meaningful information in its debug data - for example, the PostgreSQL database driver implementation does this rather than relying on a higher-level layer like Vapor to obfuscate potentially sensitive information. This PR changes the logging of errors to include the debug information (and only the logging; the responses sent to clients are unchanged).
Update Minimum Swift Version to 5.6
This patch was authored and released by @0xTim.
Inline with the Swift version support and NIO's supported version, this sets the minimum supported Swift version to 5.6 now that Swift 5.8 is released.
This is also the first step in adopting Sendable
properly across Vapor