16 Commits
Author SHA1 Message Date
George BarnettandGitHub 086524fd8a Fix sendability issues in the connection pool (#833)
Motivation:

The connection pool holds much of the low level logic in AHC. We should
fix its sendability issues before moving to higher levels.

Modifications:

- Make HTTP1ConnectionDelegate and HTTP2Delegate sendable, this requires
passing IDs rather than connections to their methods
- Make HTTPConnectionRequester sendable and have its methods take
Sendable views of the HTTP1Connection and HTTP2Connection types
- Add sendable views to HTTP1Connection and HTTP2Connection
- Mark HTTP1Connection and HTTP2Connection as not sendable
- Make HTTPRequestExecutor and HTTPExecutableRequest sendable
- Update tests

Result:

Connection pool has stricter sendability requirements
2025-04-28 15:33:38 +01:00
Rick Newton-RogersandGitHub c621142327 Adopt GitHub actions (#780)
Migrate CI to use GitHub Actions.

### Motivation:

To migrate to GitHub actions and centralised infrastructure.

### Modifications:

Changes of note:
* Adopt swift-format using rules from SwiftNIO.
* Remove scripts and docker files which are no longer needed.
* Disabled warnings-as-errors on Swift 6.0 CI pipelines for now.

### Result:

Feature parity with old CI.
2024-10-29 15:01:46 +00:00
aryan-25andGitHub 4316ecae09 Add support for request body to be larger than 2GB on 32-bit devices (#746)
### Motivation:

- The properties that store the request body length and the cumulative number of bytes sent as part of a request are of type `Int`. 
- On 32-bit devices, when sending requests larger than `Int32.max`, these properties overflow and cause a crash.
- To solve this problem, the properties should use the explicit `Int64` type.

### Modifications:

- Changed the type of the `known` field of the `RequestBodyLength` enum to `Int64`.
- Changed the type of `expectedBodyLength` and `sentBodyBytes` in `HTTPRequestStateMachine` to `Int64?` and `Int64` respectively.
- Deprecated the `public var length: Int?` property of `HTTPClient.Body` and backed it with a new property: `contentLength: Int64?`
  - Added a new initializer and "overloaded" the `stream` function in `HTTPClient.Body` to work with the new `contentLength` property.
  - **Note:** The newly added `stream` function has different parameter names (`length` -> `contentLength` and `stream` -> `bodyStream`) to avoid ambiguity problems.
- Added a test case that streams a 3GB request -- verified this fails with the types of the properties set explicitly to `Int32`. 

### Result:

- 32-bit devices can send requests larger than 2GB without integer overflow issues.
2024-06-28 11:33:04 +02:00
Fabian FettandGitHub af5966f1d1 Reduce use of HTTPClient.Configuration in the Connection objects (#635) 2022-10-07 08:05:28 -07:00
Fabian FettandGitHub 897d49aa1b Replace Lock with NIOLock (#628)
SwiftNIO 2.42.0 has deprecated Lock and replaced it with a new NIOLock. This commit removes all uses of Lock and replaces them with NIOLock. Further, now, we must require SwiftNIO 2.42.0
2022-09-27 15:42:47 +02:00
Fabian FettandGitHub 29d194f4c4 Fix flaky test: testConnectionClosesAfterTheRequestWithoutHavingSentAnCloseHeader (#520) 2021-12-06 18:31:32 +01:00
Fabian FettandGitHub 170fd536f9 Support informational response heads (#469) 2021-11-10 13:33:38 +01:00
Fabian FettandGitHub d49602f96f Fix failing test based on HTTPDecoder that supports informational responses (#470) 2021-11-09 15:42:49 +01:00
Fabian FettandGitHub d0d4598f56 Replace tests that depend on task handler (#444) 2021-09-29 12:14:17 +02:00
Fabian FettandGitHub 16ad7588b1 [HTTP1Connection] Handle 101 Switching Protocols (#442) 2021-09-28 09:52:26 +02:00
Fabian FettandGitHub 7ff7ab43ae [HTTP1Connection] Add download streaming backpressure test (#435)
### Motivation

In #427 we switched the implementation over to our new `HTTPConnectionPool`. When we did this, we removed the possibility to access the requests underlying channel. For this reason we needed to remove a number of tests from `HTTPClientInternalTests`. As @weissi pointed out, we should at least still integration test downstream backpressure.

This pr replicates the behavior from `HTTPClientInternalTests.testUploadStreamingBackpressure` directly on the `HTTP1Connection`.

### Changes

- Move and adjust test from `HTTPClientInternalTests.testUploadStreamingBackpressure`
- Rename the test to `testDownloadStreamingBackpressure` since we only test incoming bytes backpressure.

### Result

An integration backpressure test, that survived #427.
2021-09-24 15:58:19 +02:00
Fabian FettandGitHub 64fbfdaeda [HTTP1Connection] Option to ignore unclean ssl shutdown errors (#432)
- a new `RequestOptions` struct was created, that can be used to set request specific options. It is required by the `HTTPExecutableRequest`
- Added support for `ignoreUncleanSSLShutdown` in the `HTTPRequestStateMachine` and the `HTTP1ConnectionStateMachine`. In http/2 `ignoreUncleanSSLShutdown` is always off.
2021-09-21 10:04:17 +02:00
Fabian FettandGitHub ed58449c04 Add tests to observe HTTP/1.1 connection closures (#423)
- Moved MockConnectionDelegate to HTTP1ConnectionTests.swift, where it is actually used.
- Added tests around sudden connection closures
2021-09-13 16:05:45 +02:00
Fabian FettandGitHub eab2a84b1c Use explicit NIO imports (#407)
* Use explicit NIO imports for `NIOCore`, `NIOPosix` and `NIOEmbedded`
* Updated dependencies
2021-08-19 21:11:49 +02:00
Fabian FettandGitHub 44efb9481b Cleanup: Connection cancel -> shutdown (#404)
* Cleanup

* Code review
2021-07-23 11:52:46 +01:00
Fabian FettandGitHub e967f9a099 Add HTTP1Connection (#400) 2021-07-13 13:32:18 +02:00