mirror of
https://github.com/apple/swift-nio-extras
synced 2026-11-28 05:14:24 +00:00
Migrate CI to use GitHub Actions. (#234)
### 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 ### Result: Feature parity with old CI.
This commit is contained in:
1 parent
11b7d82b51
commit
3f776e9aaf
125 files changed
+4697
-3338
No files matched your search
@@ -25,7 +25,9 @@ private struct BaseClientCodec {
|
||||
|
||||
private var outgoingHTTP1RequestHead: HTTPRequest?
|
||||
|
||||
mutating func processInboundData(_ data: HTTP2Frame.FramePayload) throws -> (first: HTTPResponsePart?, second: HTTPResponsePart?) {
|
||||
mutating func processInboundData(
|
||||
_ data: HTTP2Frame.FramePayload
|
||||
) throws -> (first: HTTPResponsePart?, second: HTTPResponsePart?) {
|
||||
switch data {
|
||||
case .headers(let headerContent):
|
||||
switch try self.headerStateMachine.newHeaders(block: headerContent.headers) {
|
||||
@@ -68,13 +70,17 @@ private struct BaseClientCodec {
|
||||
}
|
||||
}
|
||||
return (first: first, second: second)
|
||||
case .alternativeService, .rstStream, .priority, .windowUpdate, .settings, .pushPromise, .ping, .goAway, .origin:
|
||||
case .alternativeService, .rstStream, .priority, .windowUpdate, .settings, .pushPromise, .ping, .goAway,
|
||||
.origin:
|
||||
// These are not meaningful in HTTP messaging, so drop them.
|
||||
return (first: nil, second: nil)
|
||||
}
|
||||
}
|
||||
|
||||
mutating func processOutboundData(_ data: HTTPRequestPart, allocator: ByteBufferAllocator) throws -> HTTP2Frame.FramePayload {
|
||||
mutating func processOutboundData(
|
||||
_ data: HTTPRequestPart,
|
||||
allocator: ByteBufferAllocator
|
||||
) throws -> HTTP2Frame.FramePayload {
|
||||
switch data {
|
||||
case .head(let head):
|
||||
precondition(self.outgoingHTTP1RequestHead == nil, "Only a single HTTP request allowed per HTTP2 stream")
|
||||
@@ -85,10 +91,12 @@ private struct BaseClientCodec {
|
||||
return .data(HTTP2Frame.FramePayload.Data(data: .byteBuffer(body)))
|
||||
case .end(let trailers):
|
||||
if let trailers {
|
||||
return .headers(.init(
|
||||
headers: HPACKHeaders(trailers),
|
||||
endStream: true
|
||||
))
|
||||
return .headers(
|
||||
.init(
|
||||
headers: HPACKHeaders(trailers),
|
||||
endStream: true
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return .data(.init(data: .byteBuffer(allocator.buffer(capacity: 0)), endStream: true))
|
||||
}
|
||||
@@ -134,7 +142,10 @@ public final class HTTP2FramePayloadToHTTPClientCodec: ChannelDuplexHandler, Rem
|
||||
let requestPart = self.unwrapOutboundIn(data)
|
||||
|
||||
do {
|
||||
let transformedPayload = try self.baseCodec.processOutboundData(requestPart, allocator: context.channel.allocator)
|
||||
let transformedPayload = try self.baseCodec.processOutboundData(
|
||||
requestPart,
|
||||
allocator: context.channel.allocator
|
||||
)
|
||||
context.write(self.wrapOutboundOut(transformedPayload), promise: promise)
|
||||
} catch {
|
||||
promise?.fail(error)
|
||||
@@ -148,7 +159,9 @@ public final class HTTP2FramePayloadToHTTPClientCodec: ChannelDuplexHandler, Rem
|
||||
private struct BaseServerCodec {
|
||||
private var headerStateMachine: HTTP2HeadersStateMachine = .init(mode: .server)
|
||||
|
||||
mutating func processInboundData(_ data: HTTP2Frame.FramePayload) throws -> (first: HTTPRequestPart?, second: HTTPRequestPart?) {
|
||||
mutating func processInboundData(
|
||||
_ data: HTTP2Frame.FramePayload
|
||||
) throws -> (first: HTTPRequestPart?, second: HTTPRequestPart?) {
|
||||
switch data {
|
||||
case .headers(let headerContent):
|
||||
if case .trailer = try self.headerStateMachine.newHeaders(block: headerContent.headers) {
|
||||
@@ -183,7 +196,10 @@ private struct BaseServerCodec {
|
||||
}
|
||||
}
|
||||
|
||||
mutating func processOutboundData(_ data: HTTPResponsePart, allocator: ByteBufferAllocator) -> HTTP2Frame.FramePayload {
|
||||
mutating func processOutboundData(
|
||||
_ data: HTTPResponsePart,
|
||||
allocator: ByteBufferAllocator
|
||||
) -> HTTP2Frame.FramePayload {
|
||||
switch data {
|
||||
case .head(let head):
|
||||
let payload = HTTP2Frame.FramePayload.Headers(headers: HPACKHeaders(head))
|
||||
@@ -193,10 +209,12 @@ private struct BaseServerCodec {
|
||||
return .data(payload)
|
||||
case .end(let trailers):
|
||||
if let trailers {
|
||||
return .headers(.init(
|
||||
headers: HPACKHeaders(trailers),
|
||||
endStream: true
|
||||
))
|
||||
return .headers(
|
||||
.init(
|
||||
headers: HPACKHeaders(trailers),
|
||||
endStream: true
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return .data(.init(data: .byteBuffer(allocator.buffer(capacity: 0)), endStream: true))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user