mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-25 04:47:50 +00:00
Motivation: Less expensive stream multiplexing. To implement direct stream multiplexing (with an incomplete public API) to break up delivery and allow testing. Modifications: * Factor out common inbound stream multiplexer functionality from `HTTP2StreamMultiplexer` into `CommonInboundStreamMultiplexer` (first commit). * Direct stream multiplexing is implemented as `InlineStreamMultiplexer`. It implements both the `HTTP2InboundStreamMultiplexer` and `HTTP2OutboundStreamMultiplexer` protocols. * We expose `NIOHTTP2Hander.StreamMultiplexer` as a `public` view over the new multiplexer to allow stream creation. * Adds various `propagate...` functions to relay signals such as read complete to the child channels held by the inline stream multiplexer. * Adds a stub for `HTTP2StreamDelegate` which will be completed in an upcoming PR. It will be responsible for surfacing stream open/close information. * Adds conveniences to `NIOHTTP2Handler` for setting up a handler using the inline multiplexer * Duplicate existing tests and modify to use the inline stream multiplexer where appropriate. `SimpleClientServerFramePayloadStreamTests.swift` and `HTTP2FramePayloadStreamMultiplexerTests.swift` were copied and modified Result: Default behavior should be unchanged at this time.
88 lines
3.4 KiB
Swift
88 lines
3.4 KiB
Swift
// swift-tools-version:5.6
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import PackageDescription
|
|
|
|
let package = Package(
|
|
name: "swift-nio-http2",
|
|
products: [
|
|
.library(name: "NIOHTTP2", targets: ["NIOHTTP2"]),
|
|
],
|
|
dependencies: [
|
|
.package(url: "https://github.com/apple/swift-nio.git", from: "2.35.0"),
|
|
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.0.2"),
|
|
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
|
|
],
|
|
targets: [
|
|
.executableTarget(
|
|
name: "NIOHTTP2Server",
|
|
dependencies: [
|
|
"NIOHTTP2",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
]),
|
|
.executableTarget(
|
|
name: "NIOHTTP2PerformanceTester",
|
|
dependencies: [
|
|
"NIOHTTP2",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
.product(name: "NIOEmbedded", package: "swift-nio"),
|
|
]),
|
|
.target(
|
|
name: "NIOHTTP2",
|
|
dependencies: [
|
|
"NIOHPACK",
|
|
.product(name: "NIO", package: "swift-nio"),
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
.product(name: "NIOTLS", package: "swift-nio"),
|
|
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
|
|
.product(name: "Atomics", package: "swift-atomics"),
|
|
]),
|
|
.target(
|
|
name: "NIOHPACK",
|
|
dependencies: [
|
|
.product(name: "NIO", package: "swift-nio"),
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
]),
|
|
.testTarget(
|
|
name: "NIOHTTP2Tests",
|
|
dependencies: [
|
|
"NIOHTTP2",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOEmbedded", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
.product(name: "NIOFoundationCompat", package: "swift-nio"),
|
|
.product(name: "Atomics", package: "swift-atomics"),
|
|
]),
|
|
.testTarget(
|
|
name: "NIOHPACKTests",
|
|
dependencies: [
|
|
"NIOHPACK",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOFoundationCompat", package: "swift-nio"),
|
|
],
|
|
resources: [
|
|
.copy("Fixtures/large_complex_huffman_b64.txt"),
|
|
.copy("Fixtures/large_huffman_b64.txt"),
|
|
]
|
|
)
|
|
]
|
|
)
|