Skip to content

Commit 69c6cf0

Browse files
authored
Bump soundness CI version and update docs (#913)
Motivation: CI is running an old version of the soundness script and some PRs are failing as a result of the outdated script. Modifications: - Bump soundness version - Fix docs Result: Newer CI scripts.
1 parent 9544287 commit 69c6cf0

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
soundness:
1212
name: Soundness
13-
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.7
13+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.13
1414
with:
1515
license_header_check_project_name: "AsyncHTTPClient"
1616
unit-tests:

Sources/AsyncHTTPClient/HTTPHandler.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -628,20 +628,20 @@ public final class ResponseAccumulator: HTTPClientResponseDelegate {
628628
}
629629
}
630630

631-
public func didReceiveBodyPart(task: HTTPClient.Task<Response>, _ part: ByteBuffer) -> EventLoopFuture<Void> {
631+
public func didReceiveBodyPart(task: HTTPClient.Task<Response>, _ buffer: ByteBuffer) -> EventLoopFuture<Void> {
632632
self.state.withLockedValue {
633633
switch $0.state {
634634
case .idle:
635635
preconditionFailure("no head received before body")
636636
case .head(let head):
637-
guard part.readableBytes <= self.maxBodySize else {
637+
guard buffer.readableBytes <= self.maxBodySize else {
638638
let error = ResponseTooBigError(maxBodySize: self.maxBodySize)
639639
$0.state = .error(error)
640640
return task.eventLoop.makeFailedFuture(error)
641641
}
642-
$0.state = .body(head, part)
642+
$0.state = .body(head, buffer)
643643
case .body(let head, var body):
644-
let newBufferSize = body.writerIndex + part.readableBytes
644+
let newBufferSize = body.writerIndex + buffer.readableBytes
645645
guard newBufferSize <= self.maxBodySize else {
646646
let error = ResponseTooBigError(maxBodySize: self.maxBodySize)
647647
$0.state = .error(error)
@@ -653,8 +653,8 @@ public final class ResponseAccumulator: HTTPClientResponseDelegate {
653653
// `self.state` or we'll get a CoW. To fix that we temporarily set the state to `.end` (which
654654
// has no associated data). We'll fix it at the bottom of this block.
655655
$0.state = .end
656-
var part = part
657-
body.writeBuffer(&part)
656+
var buffer = buffer
657+
body.writeBuffer(&buffer)
658658
$0.state = .body(head, body)
659659
case .end:
660660
preconditionFailure("request already processed")

Sources/AsyncHTTPClient/NIOTransportServices/NWErrorHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extension HTTPClient {
3232

3333
/// Initialise a NWPOSIXError
3434
/// - Parameters:
35-
/// - errorType: posix error type
35+
/// - errorCode: posix error code
3636
/// - reason: String describing reason for error
3737
public init(_ errorCode: POSIXErrorCode, reason: String) {
3838
self.errorCode = errorCode

Sources/AsyncHTTPClient/Utils.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public final class HTTPClientCopyingDelegate: HTTPClientResponseDelegate, Sendab
3232
self.chunkHandler(buffer)
3333
}
3434

35+
/// Called when the complete HTTP request is finished.
36+
///
37+
/// The body was already handed to the `chunkHandler` as it arrived, so there is nothing to return.
3538
public func didFinishRequest(task: HTTPClient.Task<Void>) throws {
3639
()
3740
}

0 commit comments

Comments
 (0)