Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: swift-server/async-http-client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.6.2
Choose a base ref
...
head repository: swift-server/async-http-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Oct 13, 2021

  1. Don't crash when hitting long backoffs. (#458)

    Motivation:
    
    If we backoff sufficiently far we can overflow Int64, which will cause
    us to crash.
    
    Modifications:
    
    Clamp the backoff value before we convert to Int64.
    
    Results:
    
    No crashes!
    Lukasa authored Oct 13, 2021
    Copy the full SHA
    1081b0b View commit details
  2. Copy the full SHA
    c1a60d8 View commit details

Commits on Oct 20, 2021

  1. Double quoted cookie values are supported now. (#460)

    Motivation:
    
    In according to RFC 6265 a cookie value may be placed between double quotes.
    
    Modifications:
    
    HTTPClient.Cookie ignores now the double quotes at the beginning and the ending of a cookie value.
    New unit test is added to check it.
    
    Result:
    
    Quoted cookie values are parsed properly now.
    fundaev authored Oct 20, 2021
    Copy the full SHA
    1361ecc View commit details

Commits on Oct 27, 2021

  1. Copy the full SHA
    4147fd6 View commit details

Commits on Nov 2, 2021

  1. Copy the full SHA
    149b8d2 View commit details
  2. Copy the full SHA
    60fef53 View commit details

Commits on Nov 3, 2021

  1. Copy the full SHA
    18a58bb View commit details
  2. Copy the full SHA
    b6fb33b View commit details

Commits on Nov 4, 2021

  1. Copy the full SHA
    7d1ed4c View commit details

Commits on Nov 9, 2021

  1. Copy the full SHA
    d49602f View commit details

Commits on Nov 10, 2021

  1. Copy the full SHA
    cc8e7a6 View commit details
  2. Copy the full SHA
    170fd53 View commit details

Commits on Nov 11, 2021

  1. Handle NIOSSLError.uncleanShutdown correctly (#472)

    ### Motivation
    
    Fixes #238 and #231.
    
    ### Changes
    
    - Extracted the unclean shutdown test from `HTTPClientTests` into their own file `HTTPClientUncleanSSLConnectionShutdownTests`
    - Copy and pasted @weissi great explanation from #238 into the test file
    - Removed property `ignoreUncleanSSLShutdown` everywhere
    
    ### Result
    
    `ignoreUncleanSSLShutdown` on `HTTPClient.Configuration` is deprecated and ignored.
    
    Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
    fabianfett and weissi authored Nov 11, 2021
    Copy the full SHA
    7617c35 View commit details
  2. Copy the full SHA
    38bbe25 View commit details
  3. Copy the full SHA
    3e44e51 View commit details
  4. Copy the full SHA
    164169a View commit details

Commits on Nov 12, 2021

  1. bind to loopback only (#476)

    dnadoba authored Nov 12, 2021
    Copy the full SHA
    68f283c View commit details
  2. [HTTP2] State in README that we support HTTP/2 (#475)

    * state in readme that we support HTTP/2 and how to disable it
    
    * move HTTP/2 up and use bullet points
    dnadoba authored Nov 12, 2021
    Copy the full SHA
    ce01ff2 View commit details

Commits on Nov 17, 2021

  1. Only crash in debug mode, if HTTPClient was not shutdown (#478)

    ### Motivation
    
    Generally we want to inform users that they need to shutdown their HTTPClient. Until `1.6.0` we did this with an assert in HTTPClient's deinit. With `1.6.0` this behavior was raised to a precondition. Because of this adopters might suddenly crash in production where they didn't before.
    
    ### Changes
    
    - This pr reverts the current behavior back to something pre `1.6.0`
    
    ### Result
    
    - HTTPClient doesn't crash in production anymore.
    fabianfett authored Nov 17, 2021
    Copy the full SHA
    ec2e080 View commit details

Commits on Nov 18, 2021

  1. Copy the full SHA
    1f3f141 View commit details

Commits on Nov 19, 2021

  1. Copy the full SHA
    2fe3f42 View commit details

Commits on Nov 22, 2021

  1. Copy the full SHA
    b479afe View commit details
  2. Two missing selfs got past soundness. (#489)

    Co-authored-by: Fabian Fett <fabianfett@apple.com>
    Lukasa and fabianfett authored Nov 22, 2021
    Copy the full SHA
    8713f95 View commit details
  3. Remove a couple of unnecessary imports (#484)

    Co-authored-by: Cory Benfield <lukasa@apple.com>
    karwa and Lukasa authored Nov 22, 2021
    Copy the full SHA
    8c48625 View commit details

Commits on Nov 23, 2021

  1. Copy the full SHA
    0ed00b8 View commit details
  2. [Tests] Add some basic IPv6 tests (#483)

    Co-authored-by: Cory Benfield <lukasa@apple.com>
    karwa and Lukasa authored Nov 23, 2021
    Copy the full SHA
    6426c00 View commit details

Commits on Nov 24, 2021

  1. Copy the full SHA
    4fd1150 View commit details

Commits on Nov 25, 2021

  1. Update swiftformat to 0.48.8 (#491)

    ### Motivation
    
    Our current swiftformat version does not support async/await. Since we want to add support for async/await we must update swiftformat or disable it. I tried my very best to keep the number of changes as small as possible. I assume we want to stick with the new 0.48.8 for some time.
    
    ### Changes
    
    - Update swiftformat to 0.48.8
    
    ### Result
    
    We can land async/await code.
    fabianfett authored Nov 25, 2021
    Copy the full SHA
    e502246 View commit details
  2. SwiftFormat --ifdef no-indent (#494)

    * SwiftFormat --ifdef no-indent
    
    * update `generate_linux_tests.rb` to use new indention rule
    dnadoba authored Nov 25, 2021
    Copy the full SHA
    9eaecbb View commit details
  3. run tests in parallel (#495)

    dnadoba authored Nov 25, 2021
    Copy the full SHA
    3b18e76 View commit details
  4. Fix flaky tests in HTTPClientSOCKSTests (#498)

    * bind to a port defined by the operating system
    dnadoba authored Nov 25, 2021
    Copy the full SHA
    f2bb283 View commit details

Commits on Nov 26, 2021

  1. Copy the full SHA
    1119893 View commit details
  2. Refactor URL component extraction (#485)

    * Refactor URL component extraction
    
    * Remove superfluous test message
    
    Co-authored-by: Fabian Fett <fabianfett@apple.com>
    Co-authored-by: David Nadoba <d_nadoba@apple.com>
    3 people authored Nov 26, 2021
    Copy the full SHA
    f2c2f73 View commit details
  3. Copy the full SHA
    83c2625 View commit details

Commits on Nov 30, 2021

  1. Introduce a ConnectionTarget enum (#501)

    * Add a ConnectionPool.Host enum
    
    * Move Host out as a top-level ConnectionTarget type, and use it in Request.
    karwa authored Nov 30, 2021
    Copy the full SHA
    f1a9187 View commit details
  2. fix nits from #501 (#503)

    dnadoba authored Nov 30, 2021
    Copy the full SHA
    591aa44 View commit details

Commits on Dec 1, 2021

  1. Copy the full SHA
    70826d0 View commit details
  2. Refactor deconstructURL and scheme parsing (#504)

    * make `Scheme` a type
    
    * introduce new Endpoint type
    
    * use endpoint as storage in `HTTPClient.Request`
    
    * fix merge conflicts
    
    * rename Endpoint to DeconstructedURL
    
    * swift-format
    
    * make `DeconstructedURL` properties `var`'s
    
    * move scheme into global namespace
    
    - rename `useTLS` to `usesTLS` where posible without breaking public API
    - only import Foundation.URL
    
    * fix review comments
    dnadoba authored Dec 1, 2021
    Copy the full SHA
    99bd384 View commit details

Commits on Dec 2, 2021

  1. Add HTTPClientRequest (#509)

    * HTTPClientRequest
    
    * move into single file
    
    * fix review comments
    
    * remove overload
    dnadoba authored Dec 2, 2021
    Copy the full SHA
    a956e7b View commit details

Commits on Dec 3, 2021

  1. Add HTTPClientReuqest.Prepared (#511)

    * add HTTPClientReuqest.Prepared
    
    * make `prepared()` an init of `Prepared`
    
    * make all stored properties of `Prepared` `var`s
    dnadoba authored Dec 3, 2021
    Copy the full SHA
    5ce7377 View commit details
  2. Improve test utils for running request (#512)

    ### Motivation
    
    To land support for async/await, we need test utilities. We already have a `MockRequestExecutor`. Let's improve this to better handle on and off `EventLoop` request processing.
    
    ### Changes
    
    - Move `MockRequestExecutor` into its own file
    - Add blocking APIs to `MockRequestExecutor` when called from another thread
    fabianfett authored Dec 3, 2021
    Copy the full SHA
    65d97ff View commit details
  3. Copy the full SHA
    474b23d View commit details

Commits on Dec 6, 2021

  1. MockRequestExecutor runRequest (#517)

    ### Motivation
    
    Our actual HTTPRequestExecutors send out an HTTPRequest as soon as they see it and they call `willExecuteRequest` and `requestHeadSent` in very fast succession on the `HTTPExecutableRequest`. We should have the same behavior in tests.
    
    ### Changes
    
    - Call `requestHeadSent` from `MockRequestExecutor.runRequest`
    - Tests that use `MockRequestExecutor` call `runRequest` on it first
    
    ### Result
    
    Cleaner, more life like tests
    fabianfett authored Dec 6, 2021
    Copy the full SHA
    93de326 View commit details
  2. Test HTTPClientRequest (#513)

    * test `HTTPClientRequest.Prepared` and `HTTPClientRequest.Body`
    
    * add scheme and headers tests
    
    * fix tests
    dnadoba authored Dec 6, 2021
    Copy the full SHA
    cc17c9c View commit details
  3. Add an AsyncWriter (#519)

    This PR adds an AsyncWriter that we can be used to test our new async upload streaming API.
    
    Co-authored-by: George Barnett <gbarnett@apple.com>
    fabianfett and glbrntt authored Dec 6, 2021
    Copy the full SHA
    a79206d View commit details
  4. Copy the full SHA
    29d194f View commit details

Commits on Dec 7, 2021

  1. Cleanup MockRequestExecutor (#521)

    In async tests, we need to wait for events that happen on the async executor. We can use ConditionLocks to wait for async events to happen while using a synchronous invocation model in the tests. In this pr we restructure `MockRequestExecutor` to use `ConditionLock`s where appropiate.
    fabianfett authored Dec 7, 2021
    Copy the full SHA
    3d7c42e View commit details

Commits on Dec 8, 2021

  1. Refactor redirect logic to be reusable for async/await (#522)

    * refactor RedirectHandler
    - `redirectState` is no longer a property of `HTTPClient.Request`. RedirectHandler now stores this state directly and therefore no longer optional.
    - we no longer count the number of allowed redirects down. Instead the number of redirects is dervied from `self.visited.count` and we compare it to the maxRedirect to check if we git the limit.
    
    * `HTTPClient.Configuration.RedirectConfiguration.Configuration` is now called `HTTPClient.Configuration.RedirectConfiguration.Mode`
    only two `Configuration`s left in the type name
    
    * add redirect logger test
    dnadoba authored Dec 8, 2021
    Copy the full SHA
    c4feafd View commit details

Commits on Dec 9, 2021

  1. Add async Transaction (#518)

    This introduces an async Transaction object. The object is the translation layer between the user facing async API and the NIO channel handler.
    fabianfett authored Dec 9, 2021
    Copy the full SHA
    24b0a14 View commit details

Commits on Dec 14, 2021

  1. add missing @available anotations (#525)

    Otherwise it fails to compile with Xcode 13.1.
    Xcode 13.2 seems fine without but this is probably a regression in the swift compiler because the @available anotations are actally needed.
    dnadoba authored Dec 14, 2021
    Copy the full SHA
    18c7266 View commit details
Showing with 24,133 additions and 7,208 deletions.
  1. +8 −0 .editorconfig
  2. +14 −0 .github/release.yml
  3. +18 −0 .github/workflows/main.yml
  4. +25 −0 .github/workflows/pull_request.yml
  5. +18 −0 .github/workflows/pull_request_label.yml
  6. +37 −0 .licenseignore
  7. +4 −0 .spi.yml
  8. +68 −0 .swift-format
  9. +0 −14 .swiftformat
  10. +2 −52 CODE_OF_CONDUCT.md
  11. +4 −4 CONTRIBUTING.md
  12. +34 −0 Examples/GetHTML/GetHTML.swift
  13. +52 −0 Examples/GetJSON/GetJSON.swift
  14. +67 −0 Examples/Package.swift
  15. +27 −0 Examples/README.md
  16. +50 −0 Examples/StreamingByteCounter/StreamingByteCounter.swift
  17. +62 −0 NOTICE.txt
  18. +40 −9 Package.swift
  19. +136 −50 README.md
  20. +48 −0 Sources/AsyncHTTPClient/AsyncAwait/AnyAsyncSequence.swift
  21. +37 −0 Sources/AsyncHTTPClient/AsyncAwait/AnyAsyncSequenceProucerDelete.swift
  22. +52 −0 Sources/AsyncHTTPClient/AsyncAwait/AsyncLazySequence.swift
  23. +223 −0 Sources/AsyncHTTPClient/AsyncAwait/HTTPClient+execute.swift
  24. +32 −0 Sources/AsyncHTTPClient/AsyncAwait/HTTPClient+shutdown.swift
  25. +131 −0 Sources/AsyncHTTPClient/AsyncAwait/HTTPClientRequest+Prepared.swift
  26. +27 −0 Sources/AsyncHTTPClient/AsyncAwait/HTTPClientRequest+auth.swift
  27. +423 −0 Sources/AsyncHTTPClient/AsyncAwait/HTTPClientRequest.swift
  28. +219 −0 Sources/AsyncHTTPClient/AsyncAwait/HTTPClientResponse.swift
  29. +45 −0 Sources/AsyncHTTPClient/AsyncAwait/SingleIteratorPrecondition.swift
  30. +554 −0 Sources/AsyncHTTPClient/AsyncAwait/Transaction+StateMachine.swift
  31. +353 −0 Sources/AsyncHTTPClient/AsyncAwait/Transaction.swift
  32. +174 −0 Sources/AsyncHTTPClient/Base64.swift
  33. +39 −0 Sources/AsyncHTTPClient/BasicAuth.swift
  34. +1 −1 Sources/AsyncHTTPClient/BestEffortHashableTLSConfiguration.swift
  35. +45 −0 Sources/AsyncHTTPClient/Configuration+BrowserLike.swift
  36. +86 −57 Sources/AsyncHTTPClient/ConnectionPool.swift
  37. +33 −5 Sources/AsyncHTTPClient/ConnectionPool/ChannelHandler/HTTP1ProxyConnectHandler.swift
  38. +1 −1 Sources/AsyncHTTPClient/ConnectionPool/ChannelHandler/SOCKSEventsHandler.swift
  39. +1 −1 Sources/AsyncHTTPClient/ConnectionPool/ChannelHandler/TLSEventsHandler.swift
  40. +300 −69 Sources/AsyncHTTPClient/ConnectionPool/{HTTP1.1 → HTTP1}/HTTP1ClientChannelHandler.swift
  41. +25 −11 Sources/AsyncHTTPClient/ConnectionPool/{HTTP1.1 → HTTP1}/HTTP1Connection.swift
  42. +140 −62 Sources/AsyncHTTPClient/ConnectionPool/{HTTP1.1 → HTTP1}/HTTP1ConnectionStateMachine.swift
  43. +192 −54 Sources/AsyncHTTPClient/ConnectionPool/HTTP2/HTTP2ClientRequestHandler.swift
  44. +84 −32 Sources/AsyncHTTPClient/ConnectionPool/HTTP2/HTTP2Connection.swift
  45. +66 −26 Sources/AsyncHTTPClient/ConnectionPool/HTTP2/HTTP2IdleHandler.swift
  46. +257 −167 Sources/AsyncHTTPClient/ConnectionPool/HTTPConnectionPool+Factory.swift
  47. +16 −11 Sources/AsyncHTTPClient/ConnectionPool/HTTPConnectionPool+Manager.swift
  48. +185 −84 Sources/AsyncHTTPClient/ConnectionPool/HTTPConnectionPool.swift
  49. +3 −3 Sources/AsyncHTTPClient/ConnectionPool/HTTPExecutableRequest.swift
  50. +4 −4 Sources/AsyncHTTPClient/ConnectionPool/HTTPRequestStateMachine+Demand.swift
  51. +299 −123 Sources/AsyncHTTPClient/ConnectionPool/HTTPRequestStateMachine.swift
  52. +24 −0 Sources/AsyncHTTPClient/ConnectionPool/RequestBodyLength.swift
  53. +1 −2 Sources/AsyncHTTPClient/ConnectionPool/RequestFramingMetadata.swift
  54. +13 −6 Sources/AsyncHTTPClient/ConnectionPool/RequestOptions.swift
  55. +12 −4 Sources/AsyncHTTPClient/ConnectionPool/State Machine/HTTPConnectionPool+Backoff.swift
  56. +205 −30 Sources/AsyncHTTPClient/ConnectionPool/State Machine/HTTPConnectionPool+HTTP1Connections.swift
  57. +257 −35 Sources/AsyncHTTPClient/ConnectionPool/State Machine/HTTPConnectionPool+HTTP1StateMachine.swift
  58. +248 −41 Sources/AsyncHTTPClient/ConnectionPool/State Machine/HTTPConnectionPool+HTTP2Connections.swift
  59. +214 −60 Sources/AsyncHTTPClient/ConnectionPool/State Machine/HTTPConnectionPool+HTTP2StateMachine.swift
  60. +51 −0 Sources/AsyncHTTPClient/ConnectionPool/State Machine/HTTPConnectionPool+RequestQueue.swift
  61. +323 −71 Sources/AsyncHTTPClient/ConnectionPool/State Machine/HTTPConnectionPool+StateMachine.swift
  62. +64 −0 Sources/AsyncHTTPClient/ConnectionTarget.swift
  63. +113 −0 Sources/AsyncHTTPClient/DeconstructedURL.swift
  64. +325 −0 Sources/AsyncHTTPClient/Docs.docc/index.md
  65. +96 −17 Sources/AsyncHTTPClient/FileDownloadDelegate.swift
  66. +75 −0 Sources/AsyncHTTPClient/FoundationExtensions.swift
  67. +165 −70 Sources/AsyncHTTPClient/HTTPClient+HTTPCookie.swift
  68. +10 −5 Sources/AsyncHTTPClient/HTTPClient+Proxy.swift
  69. +698 −247 Sources/AsyncHTTPClient/HTTPClient.swift
  70. +454 −281 Sources/AsyncHTTPClient/HTTPHandler.swift
  71. +5 −3 Sources/AsyncHTTPClient/LRUCache.swift
  72. +50 −47 Sources/AsyncHTTPClient/NIOTransportServices/NWErrorHandler.swift
  73. +44 −0 Sources/AsyncHTTPClient/NIOTransportServices/NWWaitingHandler.swift
  74. +169 −149 Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift
  75. +143 −0 Sources/AsyncHTTPClient/RedirectState.swift
  76. +206 −72 Sources/AsyncHTTPClient/RequestBag+StateMachine.swift
  77. +137 −71 Sources/AsyncHTTPClient/RequestBag.swift
  78. +132 −91 Sources/AsyncHTTPClient/RequestValidation.swift
  79. +21 −11 Sources/AsyncHTTPClient/SSLContextCache.swift
  80. +63 −0 Sources/AsyncHTTPClient/Scheme.swift
  81. +35 −0 Sources/AsyncHTTPClient/Singleton.swift
  82. +1 −1 Sources/AsyncHTTPClient/StringConvertibleInstances.swift
  83. +43 −4 Sources/AsyncHTTPClient/Utils.swift
  84. +43 −0 Sources/CAsyncHTTPClient/CAsyncHTTPClient.c
  85. +34 −0 Sources/CAsyncHTTPClient/include/CAsyncHTTPClient.h
  86. +1,055 −0 Tests/AsyncHTTPClientTests/AsyncAwaitEndToEndTests.swift
  87. +195 −0 Tests/AsyncHTTPClientTests/AsyncTestHelpers.swift
  88. +76 −0 Tests/AsyncHTTPClientTests/ConnectionPoolSizeConfigValueIsRespectedTests.swift
  89. +6 −5 Tests/AsyncHTTPClientTests/EmbeddedChannel+HTTPConvenience.swift
  90. +0 −36 Tests/AsyncHTTPClientTests/HTTP1ClientChannelHandlerTests+XCTest.swift
  91. +640 −105 Tests/AsyncHTTPClientTests/HTTP1ClientChannelHandlerTests.swift
  92. +0 −47 Tests/AsyncHTTPClientTests/HTTP1ConnectionStateMachineTests+XCTest.swift
  93. +249 −61 Tests/AsyncHTTPClientTests/HTTP1ConnectionStateMachineTests.swift
  94. +0 −42 Tests/AsyncHTTPClientTests/HTTP1ConnectionTests+XCTest.swift
  95. +324 −243 Tests/AsyncHTTPClientTests/HTTP1ConnectionTests.swift
  96. +0 −35 Tests/AsyncHTTPClientTests/HTTP1ProxyConnectHandlerTests+XCTest.swift
  97. +7 −1 Tests/AsyncHTTPClientTests/HTTP1ProxyConnectHandlerTests.swift
  98. +0 −34 Tests/AsyncHTTPClientTests/HTTP2ClientRequestHandlerTests+XCTest.swift
  99. +358 −68 Tests/AsyncHTTPClientTests/HTTP2ClientRequestHandlerTests.swift
  100. +587 −0 Tests/AsyncHTTPClientTests/HTTP2ClientTests.swift
  101. +0 −34 Tests/AsyncHTTPClientTests/HTTP2ConnectionTests+XCTest.swift
  102. +233 −66 Tests/AsyncHTTPClientTests/HTTP2ConnectionTests.swift
  103. +0 −40 Tests/AsyncHTTPClientTests/HTTP2IdleHandlerTests+XCTest.swift
  104. +141 −15 Tests/AsyncHTTPClientTests/HTTP2IdleHandlerTests.swift
  105. +0 −35 Tests/AsyncHTTPClientTests/HTTPClient+SOCKSTests+XCTest.swift
  106. +46 −17 Tests/AsyncHTTPClientTests/HTTPClient+SOCKSTests.swift
  107. +92 −0 Tests/AsyncHTTPClientTests/HTTPClientBase.swift
  108. +0 −36 Tests/AsyncHTTPClientTests/HTTPClientCookieTests+XCTest.swift
  109. +420 −13 Tests/AsyncHTTPClientTests/HTTPClientCookieTests.swift
  110. +133 −0 Tests/AsyncHTTPClientTests/HTTPClientInformationalResponsesTests.swift
  111. +0 −40 Tests/AsyncHTTPClientTests/HTTPClientInternalTests+XCTest.swift
  112. +250 −49 Tests/AsyncHTTPClientTests/HTTPClientInternalTests.swift
  113. +0 −35 Tests/AsyncHTTPClientTests/HTTPClientNIOTSTests+XCTest.swift
  114. +107 −55 Tests/AsyncHTTPClientTests/HTTPClientNIOTSTests.swift
  115. +785 −0 Tests/AsyncHTTPClientTests/HTTPClientRequestTests.swift
  116. +64 −0 Tests/AsyncHTTPClientTests/HTTPClientResponseTests.swift
  117. +586 −266 Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift
  118. +0 −142 Tests/AsyncHTTPClientTests/HTTPClientTests+XCTest.swift
  119. +2,301 −1,117 Tests/AsyncHTTPClientTests/HTTPClientTests.swift
  120. +322 −0 Tests/AsyncHTTPClientTests/HTTPClientUncleanSSLConnectionShutdownTests.swift
  121. +0 −34 Tests/AsyncHTTPClientTests/HTTPConnectionPool+FactoryTests+XCTest.swift
  122. +91 −52 Tests/AsyncHTTPClientTests/HTTPConnectionPool+FactoryTests.swift
  123. +0 −40 Tests/AsyncHTTPClientTests/HTTPConnectionPool+HTTP1ConnectionsTest+XCTest.swift
  124. +377 −11 Tests/AsyncHTTPClientTests/HTTPConnectionPool+HTTP1ConnectionsTest.swift
  125. +0 −46 Tests/AsyncHTTPClientTests/HTTPConnectionPool+HTTP1StateTests+XCTest.swift
  126. +212 −65 Tests/AsyncHTTPClientTests/HTTPConnectionPool+HTTP1StateTests.swift
  127. +0 −45 Tests/AsyncHTTPClientTests/HTTPConnectionPool+HTTP2ConnectionsTest+XCTest.swift
  128. +250 −32 Tests/AsyncHTTPClientTests/HTTPConnectionPool+HTTP2ConnectionsTest.swift
  129. +0 −41 Tests/AsyncHTTPClientTests/HTTPConnectionPool+HTTP2StateMachineTests+XCTest.swift
  130. +1,090 −102 Tests/AsyncHTTPClientTests/HTTPConnectionPool+HTTP2StateMachineTests.swift
  131. +0 −33 Tests/AsyncHTTPClientTests/HTTPConnectionPool+ManagerTests+XCTest.swift
  132. +25 −19 Tests/AsyncHTTPClientTests/HTTPConnectionPool+ManagerTests.swift
  133. +0 −31 Tests/AsyncHTTPClientTests/HTTPConnectionPool+RequestQueueTests+XCTest.swift
  134. +2 −1 Tests/AsyncHTTPClientTests/HTTPConnectionPool+RequestQueueTests.swift
  135. +78 −14 Tests/AsyncHTTPClientTests/HTTPConnectionPool+StateTestUtils.swift
  136. +0 −38 Tests/AsyncHTTPClientTests/HTTPConnectionPoolTests+XCTest.swift
  137. +192 −76 Tests/AsyncHTTPClientTests/HTTPConnectionPoolTests.swift
  138. +0 −65 Tests/AsyncHTTPClientTests/HTTPRequestStateMachineTests+XCTest.swift
  139. +604 −214 Tests/AsyncHTTPClientTests/HTTPRequestStateMachineTests.swift
  140. +41 −0 Tests/AsyncHTTPClientTests/IdleTimeoutNoReuseTests.swift
  141. +0 −33 Tests/AsyncHTTPClientTests/LRUCacheTests+XCTest.swift
  142. +2 −1 Tests/AsyncHTTPClientTests/LRUCacheTests.swift
  143. +121 −11 Tests/AsyncHTTPClientTests/Mocks/MockConnectionPool.swift
  144. +164 −0 Tests/AsyncHTTPClientTests/Mocks/MockHTTPExecutableRequest.swift
  145. +285 −0 Tests/AsyncHTTPClientTests/Mocks/MockRequestExecutor.swift
  146. +6 −5 Tests/AsyncHTTPClientTests/Mocks/MockRequestQueuer.swift
  147. +87 −0 Tests/AsyncHTTPClientTests/NWWaitingHandlerTests.swift
  148. +81 −0 Tests/AsyncHTTPClientTests/NoBytesSentOverBodyLimitTests.swift
  149. +47 −0 Tests/AsyncHTTPClientTests/RacePoolIdleConnectionsAndGetTests.swift
  150. +0 −38 Tests/AsyncHTTPClientTests/RequestBagTests+XCTest.swift
  151. +693 −204 Tests/AsyncHTTPClientTests/RequestBagTests.swift
  152. +0 −48 Tests/AsyncHTTPClientTests/RequestValidationTests+XCTest.swift
  153. +121 −68 Tests/AsyncHTTPClientTests/RequestValidationTests.swift
  154. +12 −0 Tests/AsyncHTTPClientTests/Resources/example.com.cert.pem
  155. +6 −0 Tests/AsyncHTTPClientTests/Resources/example.com.private-key.pem
  156. +27 −0 Tests/AsyncHTTPClientTests/Resources/self_signed_cert.pem
  157. +52 −0 Tests/AsyncHTTPClientTests/Resources/self_signed_key.pem
  158. +46 −0 Tests/AsyncHTTPClientTests/ResponseDelayGetTests.swift
  159. +0 −35 Tests/AsyncHTTPClientTests/SOCKSEventsHandlerTests+XCTest.swift
  160. +2 −1 Tests/AsyncHTTPClientTests/SOCKSEventsHandlerTests.swift
  161. +56 −19 Tests/AsyncHTTPClientTests/SOCKSTestUtils.swift
  162. +0 −33 Tests/AsyncHTTPClientTests/SSLContextCacheTests+XCTest.swift
  163. +37 −16 Tests/AsyncHTTPClientTests/SSLContextCacheTests.swift
  164. +58 −0 Tests/AsyncHTTPClientTests/StressGetHttpsTests.swift
  165. +0 −34 Tests/AsyncHTTPClientTests/TLSEventsHandlerTests+XCTest.swift
  166. +2 −1 Tests/AsyncHTTPClientTests/TLSEventsHandlerTests.swift
  167. +285 −0 Tests/AsyncHTTPClientTests/Transaction+StateMachineTests.swift
  168. +678 −0 Tests/AsyncHTTPClientTests/TransactionTests.swift
  169. +91 −0 Tests/AsyncHTTPClientTests/XCTest+AsyncAwait.swift
  170. +0 −57 Tests/LinuxMain.swift
  171. +0 −34 docker/Dockerfile
  172. +0 −18 docker/docker-compose.1604.52.yaml
  173. +0 −18 docker/docker-compose.1804.53.yaml
  174. +0 −18 docker/docker-compose.2004.54.yaml
  175. +0 −19 docker/docker-compose.2004.55.yaml
  176. +0 −18 docker/docker-compose.2004.main.yaml
  177. +0 −41 docker/docker-compose.yaml
  178. +0 −136 scripts/check_no_api_breakages.sh
  179. +0 −39 scripts/generate_contributors_list.sh
  180. +0 −114 scripts/generate_docs.sh
  181. +0 −231 scripts/generate_linux_tests.rb
  182. +0 −164 scripts/soundness.sh
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
14 changes: 14 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
changelog:
categories:
- title: SemVer Major
labels:
- ⚠️ semver/major
- title: SemVer Minor
labels:
- 🆕 semver/minor
- title: SemVer Patch
labels:
- 🔨 semver/patch
- title: Other Changes
labels:
- semver/none
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Main

on:
push:
branches: [main]
schedule:
- cron: "0 8,20 * * *"

jobs:
unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_6_1_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
25 changes: 25 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
license_header_check_project_name: "AsyncHTTPClient"
unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_6_1_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
18 changes: 18 additions & 0 deletions .github/workflows/pull_request_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR label

on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]

jobs:
semver-label-check:
name: Semantic version label check
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Check for Semantic Version label
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main
37 changes: 37 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.gitignore
**/.gitignore
.licenseignore
.gitattributes
.git-blame-ignore-revs
.mailfilter
.mailmap
.spi.yml
.swift-format
.editorconfig
.github/*
*.md
*.txt
*.yml
*.yaml
*.json
Package.swift
**/Package.swift
Package@-*.swift
**/Package@-*.swift
Package.resolved
**/Package.resolved
Makefile
*.modulemap
**/*.modulemap
**/*.docc/*
*.xcprivacy
**/*.xcprivacy
*.symlink
**/*.symlink
Dockerfile
**/Dockerfile
.dockerignore
Snippets/*
dev/git.commit.template
.unacceptablelanguageignore
Tests/AsyncHTTPClientTests/Resources/*.pem
4 changes: 4 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 1
builder:
configs:
- documentation_targets: [AsyncHTTPClient]
68 changes: 68 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"version" : 1,
"indentation" : {
"spaces" : 4
},
"tabWidth" : 4,
"fileScopedDeclarationPrivacy" : {
"accessLevel" : "private"
},
"spacesAroundRangeFormationOperators" : false,
"indentConditionalCompilationBlocks" : false,
"indentSwitchCaseLabels" : false,
"lineBreakAroundMultilineExpressionChainComponents" : false,
"lineBreakBeforeControlFlowKeywords" : false,
"lineBreakBeforeEachArgument" : true,
"lineBreakBeforeEachGenericRequirement" : true,
"lineLength" : 120,
"maximumBlankLines" : 1,
"respectsExistingLineBreaks" : true,
"prioritizeKeepingFunctionOutputTogether" : true,
"noAssignmentInExpressions" : {
"allowedFunctions" : [
"XCTAssertNoThrow",
"XCTAssertThrowsError"
]
},
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : false,
"AlwaysUseLiteralForEmptyCollectionInit" : false,
"AlwaysUseLowerCamelCase" : false,
"AmbiguousTrailingClosureOverload" : true,
"BeginDocumentationCommentWithOneLineSummary" : false,
"DoNotUseSemicolons" : true,
"DontRepeatTypeInStaticProperties" : true,
"FileScopedDeclarationPrivacy" : true,
"FullyIndirectEnum" : true,
"GroupNumericLiterals" : true,
"IdentifiersMustBeASCII" : true,
"NeverForceUnwrap" : false,
"NeverUseForceTry" : false,
"NeverUseImplicitlyUnwrappedOptionals" : false,
"NoAccessLevelOnExtensionDeclaration" : true,
"NoAssignmentInExpressions" : true,
"NoBlockComments" : true,
"NoCasesWithOnlyFallthrough" : true,
"NoEmptyTrailingClosureParentheses" : true,
"NoLabelsInCasePatterns" : true,
"NoLeadingUnderscores" : false,
"NoParensAroundConditions" : true,
"NoVoidReturnOnFunctionSignature" : true,
"OmitExplicitReturns" : true,
"OneCasePerLine" : true,
"OneVariableDeclarationPerLine" : true,
"OnlyOneTrailingClosureArgument" : true,
"OrderedImports" : true,
"ReplaceForEachWithForLoop" : true,
"ReturnVoidInsteadOfEmptyTuple" : true,
"UseEarlyExits" : false,
"UseExplicitNilCheckInConditions" : false,
"UseLetInEveryBoundCaseVariable" : false,
"UseShorthandTypeNames" : true,
"UseSingleLinePropertyGetter" : false,
"UseSynthesizedInitializer" : false,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
}
}
14 changes: 0 additions & 14 deletions .swiftformat

This file was deleted.

54 changes: 2 additions & 52 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,5 @@
# Code of Conduct
To be a truly great community, AsyncHTTPClient needs to welcome developers from all walks of life,
with different backgrounds, and with a wide range of experience. A diverse and friendly
community will have more great ideas, more unique perspectives, and produce more great
code. We will work diligently to make the AsyncHTTPClient community welcoming to everyone.

To give clarity of what is expected of our members, AsyncHTTPClient has adopted the code of conduct
defined by [contributor-covenant.org](https://www.contributor-covenant.org). This document is used across many open source
communities, and we think it articulates our values well. The full text is copied below:
The code of conduct for this project can be found at https://swift.org/code-of-conduct.

### Contributor Code of Conduct v1.3
As contributors and maintainers of this project, and in the interest of fostering an open and
welcoming community, we pledge to respect all people who contribute through reporting
issues, posting feature requests, updating documentation, submitting pull requests or patches,
and other activities.

We are committed to making participation in this project a harassment-free experience for
everyone, regardless of level of experience, gender, gender identity and expression, sexual
orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or
nationality.

Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery
- Personal attacks
- Trolling or insulting/derogatory comments
- Public or private harassment
- Publishing other’s private information, such as physical or electronic addresses, without explicit permission
- Other unethical or unprofessional conduct

Project maintainers have the right and responsibility to remove, edit, or reject comments,
commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of
Conduct, or to ban temporarily or permanently any contributor for other behaviors that they
deem inappropriate, threatening, offensive, or harmful.

By adopting this Code of Conduct, project maintainers commit themselves to fairly and
consistently applying these principles to every aspect of managing this project. Project
maintainers who do not follow or enforce the Code of Conduct may be permanently removed
from the project team.

This code of conduct applies both within project spaces and in public spaces when an
individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
contacting a project maintainer at [conduct@swiftserver.group](mailto:conduct@swiftserver.group). All complaints will be reviewed and
investigated and will result in a response that is deemed necessary and appropriate to the
circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter
of an incident.

*This policy is adapted from the Contributor Code of Conduct [version 1.3.0](https://contributor-covenant.org/version/1/3/0/).*

### Reporting
A working group of community members is committed to promptly addressing any [reported issues](mailto:conduct@swiftserver.group).
Working group members are volunteers appointed by the project lead, with a
preference for individuals with varied backgrounds and perspectives. Membership is expected
to change regularly, and may grow or shrink.
<!-- Copyright (c) 2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -57,18 +57,18 @@ A good AsyncHTTPClient patch is:
3. Documented, adding API documentation as needed to cover new functions and properties.
4. Accompanied by a great commit message, using our commit message template.

*Note* as of version 1.5.0 AsyncHTTPClient requires Swift 5.2. Earlier versions support as far back as Swift 5.0.
*Note* as of version 1.10.0 AsyncHTTPClient requires Swift 5.4. Earlier versions support as far back as Swift 5.0.

### Commit Message Template

We require that your commit messages match our template. The easiest way to do that is to get git to help you by explicitly using the template. To do that, `cd` to the root of our repository and run:

git config commit.template dev/git.commit.template

### Make sure Tests work on Linux

AsyncHTTPClient uses XCTest to run tests on both macOS and Linux. While the macOS version of XCTest is able to use the Objective-C runtime to discover tests at execution time, the Linux version is not.
For this reason, whenever you add new tests **you have to run a script** that generates the hooks needed to run those tests on Linux, or our CI will complain that the tests are not all present on Linux. To do this, merely execute `ruby ./scripts/generate_linux_tests.rb` at the root of the package and check the changes it made.
### Run CI checks locally

You can run the Github Actions workflows locally using [act](https://github.com/nektos/act). For detailed steps on how to do this please see [https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally](https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally).

## How to contribute your work

34 changes: 34 additions & 0 deletions Examples/GetHTML/GetHTML.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the AsyncHTTPClient open source project
//
// Copyright (c) 2022 Apple Inc. and the AsyncHTTPClient project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of AsyncHTTPClient project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import AsyncHTTPClient
import NIOCore

@main
struct GetHTML {
static func main() async throws {
let httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
do {
let request = HTTPClientRequest(url: "https://apple.com")
let response = try await httpClient.execute(request, timeout: .seconds(30))
print("HTTP head", response)
let body = try await response.body.collect(upTo: 1024 * 1024) // 1 MB
print(String(buffer: body))
} catch {
print("request failed:", error)
}
// it is important to shutdown the httpClient after all requests are done, even if one failed
try await httpClient.shutdown()
}
}
52 changes: 52 additions & 0 deletions Examples/GetJSON/GetJSON.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the AsyncHTTPClient open source project
//
// Copyright (c) 2022 Apple Inc. and the AsyncHTTPClient project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of AsyncHTTPClient project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import AsyncHTTPClient
import Foundation
import NIOCore
import NIOFoundationCompat

struct Comic: Codable {
var num: Int
var title: String
var day: String
var month: String
var year: String
var img: String
var alt: String
var news: String
var link: String
var transcript: String
}

@main
struct GetJSON {
static func main() async throws {
let httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
do {
let request = HTTPClientRequest(url: "https://xkcd.com/info.0.json")
let response = try await httpClient.execute(request, timeout: .seconds(30))
print("HTTP head", response)
let body = try await response.body.collect(upTo: 1024 * 1024) // 1 MB
// we use an overload defined in `NIOFoundationCompat` for `decode(_:from:)` to
// efficiently decode from a `ByteBuffer`
let comic = try JSONDecoder().decode(Comic.self, from: body)
dump(comic)
} catch {
print("request failed:", error)
}
// it is important to shutdown the httpClient after all requests are done, even if one failed
try await httpClient.shutdown()
}
}
Loading