Skip to content

Releases: vapor/vapor

4.78.0 - Allow specifying a timeout for client requests

02 Aug 07:55
6b96684
Compare
Choose a tag to compare

What's Changed

Allow specifying a timeout for client requests by @ffried in #3043

Adds a timeout property to ClientRequest, which is forwarded to HTTPClient by EventLoopHTTPClient.
To use it, the beforeSend 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

18 Jul 19:52
e98077d
Compare
Choose a tag to compare
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`

05 Jul 13:07
1baf623
Compare
Choose a tag to compare
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:)`

30 May 08:11
9a340de
Compare
Choose a tag to compare
This patch was authored by @MahdiBM and released by @0xTim.

Adds ContentContainer.decode(_:as:) to compliment ContentContainer.encode(_:as:) to make it easy to override the Content-Type if calling an API or decoding a request that returns erroneous headers for the body type.

Fixed drain handler call order in case of asynchronous buffer handling

29 May 10:52
f0aed18
Compare
Choose a tag to compare
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:

  1. Open new file descriptor
  2. During .collected stage write ByteBuffer on disc using this file descriptor
  3. 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

22 May 15:53
8b79ff0
Compare
Choose a tag to compare
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

16 May 11:35
b42287f
Compare
Choose a tag to compare
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

15 May 12:07
ac263f7
Compare
Choose a tag to compare
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

11 Apr 13:27
f4b00a5
Compare
Choose a tag to compare
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

Fix crash when collecting the body

11 Apr 12:20
00bd82b
Compare
Choose a tag to compare
This patch was authored and released by @0xTim.

Fixes an issue where users may experience a crash when collecting the body in async routes due to pre-concurrency assumptions made by Vapor.

Resolves #2990