Clean up dependencies and imports. (#1935)

Motivation:

As we've largely completed our move to split out our core abstractions,
we now have an opportunity to clean up our dependencies and imports. We
should arrange for everything to only import NIO if it actually needs
it, and to correctly express dependencies on NIOCore and NIOEmbedded
where they exist.

We aren't yet splitting out tests that only test functionality in
NIOCore, that will follow in a separate patch.

Modifications:

- Fixed up imports
- Made sure our protocols only require NIOCore.

Result:

Better expression of dependencies.

Co-authored-by: George Barnett <gbarnett@apple.com>
This commit is contained in:
Cory BenfieldandGeorge Barnett authored and GitHub committed 2021-08-12 13:49:46 +01:00
1 parent f2ab9ab422
commit 64285cbff2
81 files changed
+199 -188

No files matched your search

+26 -26
View File
@@ -29,8 +29,8 @@ var targets: [PackageDescription.Target] = [
"_NIODataStructures",
"NIOEmbedded"]),
.target(name: "_NIOConcurrency",
dependencies: ["NIO"]),
.target(name: "NIOFoundationCompat", dependencies: ["NIO"]),
dependencies: ["NIOCore"]),
.target(name: "NIOFoundationCompat", dependencies: ["NIOCore"]),
.target(name: "CNIOAtomics", dependencies: []),
.target(name: "CNIOSHA1", dependencies: []),
.target(name: "CNIOLinux", dependencies: []),
@@ -39,59 +39,59 @@ var targets: [PackageDescription.Target] = [
.target(name: "NIOConcurrencyHelpers",
dependencies: ["CNIOAtomics"]),
.target(name: "NIOHTTP1",
dependencies: ["NIO", "NIOConcurrencyHelpers", "CNIOHTTPParser"]),
dependencies: ["NIOCore", "NIOConcurrencyHelpers", "CNIOHTTPParser"]),
.target(name: "NIOEchoServer",
dependencies: ["NIO", "NIOConcurrencyHelpers"]),
dependencies: ["NIO", "NIOCore", "NIOConcurrencyHelpers"]),
.target(name: "NIOEchoClient",
dependencies: ["NIO", "NIOConcurrencyHelpers"]),
dependencies: ["NIO", "NIOCore", "NIOConcurrencyHelpers"]),
.target(name: "NIOHTTP1Server",
dependencies: ["NIO", "NIOHTTP1", "NIOConcurrencyHelpers"]),
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "NIOConcurrencyHelpers"]),
.target(name: "NIOHTTP1Client",
dependencies: ["NIO", "NIOHTTP1", "NIOConcurrencyHelpers"]),
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "NIOConcurrencyHelpers"]),
.target(name: "CNIOHTTPParser"),
.target(name: "NIOTLS", dependencies: ["NIO"]),
.target(name: "NIOTLS", dependencies: ["NIOCore"]),
.target(name: "NIOChatServer",
dependencies: ["NIO", "NIOConcurrencyHelpers"]),
dependencies: ["NIO", "NIOCore", "NIOConcurrencyHelpers"]),
.target(name: "NIOChatClient",
dependencies: ["NIO", "NIOConcurrencyHelpers"]),
dependencies: ["NIO", "NIOCore", "NIOConcurrencyHelpers"]),
.target(name: "NIOWebSocket",
dependencies: ["NIO", "NIOHTTP1", "CNIOSHA1"]),
dependencies: ["NIOCore", "NIOHTTP1", "CNIOSHA1"]),
.target(name: "NIOWebSocketServer",
dependencies: ["NIO", "NIOHTTP1", "NIOWebSocket"]),
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "NIOWebSocket"]),
.target(name: "NIOWebSocketClient",
dependencies: ["NIO", "NIOHTTP1", "NIOWebSocket"]),
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "NIOWebSocket"]),
.target(name: "NIOPerformanceTester",
dependencies: ["NIO", "NIOHTTP1", "NIOFoundationCompat", "NIOWebSocket"]),
dependencies: ["NIO", "NIOCore", "NIOEmbedded", "NIOHTTP1", "NIOFoundationCompat", "NIOWebSocket"]),
.target(name: "NIOMulticastChat",
dependencies: ["NIO"]),
dependencies: ["NIO", "NIOCore"]),
.target(name: "NIOUDPEchoServer",
dependencies: ["NIO"]),
dependencies: ["NIO", "NIOCore"]),
.target(name: "NIOUDPEchoClient",
dependencies: ["NIO"]),
dependencies: ["NIO", "NIOCore"]),
.target(name: "NIOTestUtils",
dependencies: ["NIO", "NIOHTTP1"]),
dependencies: ["NIO", "NIOCore", "NIOEmbedded", "NIOHTTP1"]),
.target(name: "NIOCrashTester",
dependencies: ["NIO", "NIOHTTP1", "NIOWebSocket", "NIOFoundationCompat"]),
dependencies: ["NIO", "NIOCore", "NIOEmbedded", "NIOHTTP1", "NIOWebSocket", "NIOFoundationCompat"]),
.target(name: "NIOAsyncAwaitDemo",
dependencies: ["NIO", "NIOHTTP1", "_NIOConcurrency"]),
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "_NIOConcurrency"]),
.testTarget(name: "NIOEmbeddedTests",
dependencies: ["NIOConcurrencyHelpers", "NIOCore", "NIOEmbedded"]),
.testTarget(name: "NIOTests",
dependencies: ["NIO", "NIOFoundationCompat", "NIOTestUtils", "NIOConcurrencyHelpers", "NIOEmbedded"]),
dependencies: ["NIO", "NIOCore", "NIOFoundationCompat", "NIOTestUtils", "NIOConcurrencyHelpers", "NIOEmbedded"]),
.testTarget(name: "NIOConcurrencyHelpersTests",
dependencies: ["NIOConcurrencyHelpers", "NIO"]),
dependencies: ["NIOConcurrencyHelpers", "NIOCore"]),
.testTarget(name: "NIODataStructuresTests",
dependencies: ["_NIODataStructures"]),
.testTarget(name: "NIOHTTP1Tests",
dependencies: ["NIOHTTP1", "NIOFoundationCompat", "NIOTestUtils"]),
dependencies: ["NIOCore", "NIOEmbedded", "NIO", "NIOHTTP1", "NIOFoundationCompat", "NIOTestUtils"]),
.testTarget(name: "NIOTLSTests",
dependencies: ["NIO", "NIOTLS", "NIOFoundationCompat"]),
dependencies: ["NIOCore", "NIOEmbedded", "NIOTLS", "NIOFoundationCompat"]),
.testTarget(name: "NIOWebSocketTests",
dependencies: ["NIO", "NIOWebSocket"]),
dependencies: ["NIOCore", "NIOEmbedded", "NIOWebSocket"]),
.testTarget(name: "NIOTestUtilsTests",
dependencies: ["NIOTestUtils"]),
.testTarget(name: "NIOFoundationCompatTests",
dependencies: ["NIO", "NIOFoundationCompat"]),
dependencies: ["NIOCore", "NIOFoundationCompat"]),
]
let package = Package(
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import NIOHTTP1
#if compiler(>=5.5) // we cannot write this on one line with `&&` because Swift 5.0 doesn't like it...
@@ -14,7 +14,7 @@
// THIS FILE IS MOSTLY COPIED FROM swift-nio-extras
import NIO
import NIOCore
import NIOHTTP1
public final class MakeFullRequestHandler: ChannelOutboundHandler {
+1 -1
View File
@@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import _NIOConcurrency
import NIOHTTP1
+2 -1
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
private final class ChatHandler: ChannelInboundHandler {
+2 -1
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import Dispatch
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
struct ByteBufferCrashTests {
let testMovingReaderIndexPastWriterIndex = CrashTest(
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
fileprivate let group = MultiThreadedEventLoopGroup(numberOfThreads: 2)
+3 -3
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,8 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOEmbedded
import NIOCore
import NIOHTTP1
struct HTTPCrashTests {
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import NIOFoundationCompat
import class Foundation.Pipe
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import class Foundation.Process
import struct Foundation.URL
+2 -1
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
print("Please enter line to send to the server")
+2 -1
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
private final class EchoHandler: ChannelInboundHandler {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import Foundation
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import Foundation
extension ByteBuffer {
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import Foundation
extension JSONSerialization {
@@ -28,4 +28,4 @@ extension JSONSerialization {
options opt: JSONSerialization.ReadingOptions = []) throws -> Any {
return try JSONSerialization.jsonObject(with: Data(buffer: buffer), options: opt)
}
}
}
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
fileprivate let defaultWhitespaces = [" ", "\t"].map({$0.utf8.first!})
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
#if compiler(>=5.1)
@_implementationOnly import CNIOHTTPParser
#else
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
private func writeChunk(wrapOutboundOut: (IOData) -> NIOAny, context: ChannelHandlerContext, isChunked: Bool, chunk: IOData, promise: EventLoopPromise<Void>?) {
let (mW1, mW2, mW3): (EventLoopPromise<Void>?, EventLoopPromise<Void>?, EventLoopPromise<Void>?)
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// Configuration required to configure a HTTP client pipeline for upgrade.
///
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,14 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
//
// HTTPServerPipelineHandler.swift
// NIOHTTP1
//
// Created by Cory Benfield on 01/03/2018.
//
import NIO
import NIOCore
/// A utility function that runs the body code only in debug builds, without
/// emitting compiler warnings.
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// A simple channel handler that catches errors emitted by parsing HTTP requests
/// and sends 400 Bad Request responses.
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// Errors that may be raised by the `HTTPServerProtocolUpgrader`.
public enum HTTPServerUpgradeErrors: Error {
+2 -3
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
let crlf: StaticString = "\r\n"
let headerSeparator: StaticString = ": "
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// Errors that may be raised by the `HTTPClientProtocolUpgrader`.
public struct NIOHTTPClientUpgradeError: Hashable, Error {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// The parts of a complete HTTP response from the view of the client.
///
+2 -1
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import NIOHTTP1
+2 -1
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import NIOHTTP1
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
/// Implements a simple chat protocol.
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
import Foundation
import NIO
import NIOCore
final class ByteBufferViewIteratorBenchmark: Benchmark {
private let iterations: Int
@@ -11,8 +11,8 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import NIOEmbedded
final class ByteToMessageDecoderDecodeManySmallsBenchmark: Benchmark {
private let iterations: Int
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,8 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import NIOEmbedded
final class ChannelPipelineBenchmark: Benchmark {
private final class NoOpHandler: ChannelInboundHandler, RemovableChannelHandler {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
import Foundation
import NIO
import NIOCore
final class CircularBufferIntoByteBufferBenchmark: Benchmark {
private let iterations: Int
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,8 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import NIOEmbedded
import NIOWebSocket
final class WebSocketFrameDecoderBenchmark {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,8 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import NIOEmbedded
import NIOWebSocket
final class WebSocketFrameEncoderBenchmark {
+3 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,9 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import NIOEmbedded
import NIOHTTP1
import NIOFoundationCompat
import Dispatch
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// The result of an ALPN negotiation.
///
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// The length of the TLS record header in bytes.
private let tlsRecordHeaderLength = 5
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,8 +11,8 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import NIOEmbedded
public enum ByteToMessageDecoderVerifier {
/// - seealso: verifyDecoder(inputOutputPairs:decoderFactory:)
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import NIOConcurrencyHelpers
/// `EventCounterHandler` is a `ChannelHandler` that counts and forwards all the events that it sees coming through
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import NIOHTTP1
import NIOConcurrencyHelpers
+2 -1
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
print("Please enter line to send to the server")
+2 -1
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
private final class EchoHandler: ChannelInboundHandler {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
import NIOHTTP1
@available(*, deprecated, renamed: "NIOWebSocketClientUpgrader")
@@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// `NIOWebSocketFrameAggregator` buffers inbound fragmented `WebSocketFrame`'s and aggregates them into a single `WebSocketFrame`.
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
import CNIOSHA1
import NIO
import NIOCore
import NIOHTTP1
let magicWebSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// An enum that represents websocket error codes.
///
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
private extension UInt8 {
func isAnyBitSetInMask(_ mask: UInt8) -> Bool {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// Errors thrown by the NIO websocket module.
public enum NIOWebSocketError: Error {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
private let maxOneByteSize = 125
private let maxTwoByteSize = Int(UInt16.max)
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
/// A simple `ChannelHandler` that catches protocol errors emitted by the
+2 -1
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import NIOHTTP1
import NIOWebSocket
+2 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIOCore
import NIO
import NIOHTTP1
import NIOWebSocket
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
#if compiler(>=5.5)
import _Concurrency
+2 -2
View File
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore
#if compiler(>=5.5)
fileprivate let hasAsyncAwait = true
@@ -20,7 +20,7 @@ fileprivate let hasAsyncAwait = true
fileprivate let hasAsyncAwait = false
#endif
extension NIO.System {
extension NIOCore.System {
public static var hasAsyncAwaitSupport: Bool {
return hasAsyncAwait
}
@@ -18,7 +18,7 @@ import Glibc
#endif
import Dispatch
import XCTest
import NIO
import NIOCore
@testable import NIOConcurrencyHelpers
class NIOConcurrencyHelpersTests: XCTestCase {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -14,7 +14,7 @@
import Foundation
import XCTest
import NIO
import NIOCore
import NIOFoundationCompat
struct FakeContiguousBytes: ContiguousBytes {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -14,7 +14,7 @@
import Foundation
import XCTest
import NIO
import NIOCore
import NIOFoundationCompat
class ByteBufferViewDataProtocolTests: XCTestCase {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -14,7 +14,7 @@
import Foundation
import XCTest
import NIO
import NIOCore
import NIOFoundationCompat
class CodableByteBufferTest: XCTestCase {
@@ -14,7 +14,7 @@
import Foundation
import XCTest
import NIO
import NIOCore
import NIOFoundationCompat
class JSONSerializationByteBufferTest: XCTestCase {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIO
import NIOCore
@testable import NIOHTTP1
fileprivate enum DummyError: Error {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -14,7 +14,8 @@
import XCTest
import Dispatch
@testable import NIO
@testable import NIOCore
import NIOEmbedded
@testable import NIOHTTP1
extension EmbeddedChannel {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIO
import NIOCore
import NIOEmbedded
import NIOHTTP1
private class MessageEndHandler<Head: Equatable, Body: Equatable>: ChannelInboundHandler {
+3 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIO
import NIOCore
import NIOEmbedded
import NIOHTTP1
import NIOTestUtils
+3 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
@testable import NIO
@testable import NIOCore
import NIOEmbedded
@testable import NIOHTTP1
class HTTPHeadersTest : XCTestCase {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,8 @@
//
//===----------------------------------------------------------------------===//
import XCTest
@testable import NIO
@testable import NIOCore
import NIOEmbedded
@testable import NIOHTTP1
private extension ByteBuffer {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,8 @@
//
//===----------------------------------------------------------------------===//
import XCTest
@testable import NIO
@testable import NIOCore
import NIOEmbedded
@testable import NIOHTTP1
private extension ByteBuffer {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIOCore
import NIO
import NIOConcurrencyHelpers
import NIOFoundationCompat
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -11,15 +11,10 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
//
// HTTPServerPipelineHandlerTest.swift
// NIOHTTP1Tests
//
// Created by Cory Benfield on 02/03/2018.
//
import XCTest
import NIO
import NIOCore
import NIOEmbedded
@testable import NIOHTTP1
private final class ReadRecorder: ChannelInboundHandler {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIO
import NIOCore
import NIOEmbedded
import NIOHTTP1
class HTTPServerProtocolErrorHandlerTest: XCTestCase {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -14,6 +14,8 @@
import XCTest
import Dispatch
import NIOCore
import NIOEmbedded
@testable import NIO
@testable import NIOHTTP1
+3 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
@testable import NIO
@testable import NIOCore
import NIOEmbedded
@testable import NIOHTTP1
private final class TestChannelInboundHandler: ChannelInboundHandler {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIO
import NIOCore
import NIOEmbedded
import NIOHTTP1
import NIOTestUtils
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
@testable import NIO
import NIOCore
import NIOEmbedded
import NIOTLS
private class ReadCompletedHandler: ChannelInboundHandler {
+3 -2
View File
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -12,7 +12,8 @@
//
//===----------------------------------------------------------------------===//
import XCTest
@testable import NIO
import NIOCore
import NIOEmbedded
import NIOFoundationCompat
import NIOTLS
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIO
import NIOCore
import NIOEmbedded
import NIOWebSocket
final class NIOWebSocketFrameAggregatorTests: XCTestCase {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
@testable import NIO
import NIOCore
import NIOEmbedded
import NIOHTTP1
@testable import NIOWebSocket
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIO
import NIOCore
import NIOEmbedded
import NIOWebSocket
private class CloseSwallower: ChannelOutboundHandler, RemovableChannelHandler {
@@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@@ -13,7 +13,8 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIO
import NIOCore
import NIOEmbedded
import NIOWebSocket
extension EmbeddedChannel {
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
import XCTest
import NIO
import NIOCore
import NIOWebSocket
final class WebSocketMaskingKeyTests: XCTestCase {
@@ -14,7 +14,7 @@
import XCTest
@testable import NIOCore
import NIO
import NIOEmbedded
import NIOHTTP1
@testable import NIOWebSocket