mirror of
https://github.com/apple/swift-http-types
synced 2026-11-22 04:30:40 +00:00
[CI] Make all CI checks green
# Motivation We just adopted GH actions and want to make sure all the CI checks are green. # Modification This PR makes the necessary changes to pass all checks. Including: - Adding a licenseignore file - Moving `swift-format` and adopting the config that we use in all other swift on server repos. # Result Green CI.
This commit is contained in:
1 parent
70cda1b770
commit
f3d9ec3eef
29 files changed
+541
-207
No files matched your search
@@ -14,12 +14,12 @@ jobs:
|
||||
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
|
||||
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
|
||||
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
|
||||
windows_6_0_enabled: true
|
||||
windows_nightly_6_0_enabled: true
|
||||
windows_nightly_main_enabled: true
|
||||
windows_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
|
||||
windows_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
|
||||
windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
|
||||
|
||||
benchmarks:
|
||||
name: Benchmarks
|
||||
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
|
||||
with:
|
||||
benchmark_package_path: "Benchmarks"
|
||||
|
||||
cxx-interop:
|
||||
name: Cxx interop
|
||||
|
||||
@@ -20,12 +20,12 @@ jobs:
|
||||
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
|
||||
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
|
||||
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
|
||||
windows_6_0_enabled: true
|
||||
windows_nightly_6_0_enabled: true
|
||||
windows_nightly_main_enabled: true
|
||||
windows_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
|
||||
windows_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
|
||||
windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
|
||||
|
||||
benchmarks:
|
||||
name: Benchmarks
|
||||
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
|
||||
with:
|
||||
benchmark_package_path: "Benchmarks"
|
||||
|
||||
cxx-interop:
|
||||
name: Cxx interop
|
||||
|
||||
@@ -14,12 +14,12 @@ jobs:
|
||||
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
|
||||
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
|
||||
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
|
||||
windows_6_0_enabled: true
|
||||
windows_nightly_6_0_enabled: true
|
||||
windows_nightly_main_enabled: true
|
||||
windows_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
|
||||
windows_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
|
||||
windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
|
||||
|
||||
benchmarks:
|
||||
name: Benchmarks
|
||||
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
|
||||
with:
|
||||
benchmark_package_path: "Benchmarks"
|
||||
|
||||
cxx-interop:
|
||||
name: Cxx interop
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
.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
|
||||
Sources/CMakeLists.txt
|
||||
Sources/SwiftASN1/CMakeLists.txt
|
||||
dev/alloc-limits-from-test-output
|
||||
dev/boxed-existentials.d
|
||||
dev/git.commit.template
|
||||
dev/lldb-smoker
|
||||
dev/make-single-file-spm
|
||||
dev/malloc-aggregation.d
|
||||
dev/update-alloc-limits-to-last-completed-ci-build
|
||||
Benchmarks/Benchmarks/SwiftASN1Benchmark/ca-certificates/*.crt
|
||||
Benchmarks/Benchmarks/SwiftASN1Benchmark/ca-certificates/*/*.crt
|
||||
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"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,
|
||||
"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
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
--swiftversion 5.7
|
||||
|
||||
# file options
|
||||
|
||||
--exclude .build
|
||||
|
||||
# format options
|
||||
|
||||
--ifdef no-indent
|
||||
--indent 4
|
||||
--extensionacl on-declarations
|
||||
--patternlet inline
|
||||
--self insert
|
||||
--stripunusedargs closure-only
|
||||
--wraparguments before-first
|
||||
|
||||
# rules
|
||||
|
||||
--disable andOperator
|
||||
--disable blankLinesAroundMark
|
||||
--disable wrapMultilineStatementBraces
|
||||
@@ -16,8 +16,18 @@ import Benchmark
|
||||
import HTTPTypes
|
||||
|
||||
let benchmarks = {
|
||||
let defaultMetrics: [BenchmarkMetric] = [
|
||||
.mallocCountTotal
|
||||
]
|
||||
|
||||
Benchmark(
|
||||
"Initialize HTTPFields from Dictionary Literal"
|
||||
"HTTPFields.init(dictionaryLiteral:)",
|
||||
configuration: .init(
|
||||
metrics: defaultMetrics,
|
||||
scalingFactor: .kilo,
|
||||
maxDuration: .seconds(10_000_000),
|
||||
maxIterations: 10
|
||||
)
|
||||
) { _ in
|
||||
let fiels: HTTPFields = [
|
||||
.contentType: "application/json",
|
||||
|
||||
@@ -5,7 +5,7 @@ import PackageDescription
|
||||
let package = Package(
|
||||
name: "Benchmarks",
|
||||
platforms: [
|
||||
.macOS(.v13),
|
||||
.macOS(.v13)
|
||||
],
|
||||
dependencies: [
|
||||
.package(path: "../"),
|
||||
@@ -20,8 +20,8 @@ let package = Package(
|
||||
],
|
||||
path: "Benchmarks/HTTPFieldsBenchmarks",
|
||||
plugins: [
|
||||
.plugin(name: "BenchmarkPlugin", package: "package-benchmark"),
|
||||
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"mallocCountTotal" : 14
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"mallocCountTotal" : 14
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"mallocCountTotal" : 14
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"mallocCountTotal" : 14
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"mallocCountTotal" : 14
|
||||
}
|
||||
+3
-6
@@ -8,27 +8,24 @@ let package = Package(
|
||||
.library(name: "HTTPTypes", targets: ["HTTPTypes"]),
|
||||
.library(name: "HTTPTypesFoundation", targets: ["HTTPTypesFoundation"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
|
||||
],
|
||||
targets: [
|
||||
.target(name: "HTTPTypes"),
|
||||
.target(
|
||||
name: "HTTPTypesFoundation",
|
||||
dependencies: [
|
||||
"HTTPTypes",
|
||||
"HTTPTypes"
|
||||
]
|
||||
),
|
||||
.testTarget(
|
||||
name: "HTTPTypesTests",
|
||||
dependencies: [
|
||||
"HTTPTypes",
|
||||
"HTTPTypes"
|
||||
]
|
||||
),
|
||||
.testTarget(
|
||||
name: "HTTPTypesFoundationTests",
|
||||
dependencies: [
|
||||
"HTTPTypesFoundation",
|
||||
"HTTPTypesFoundation"
|
||||
]
|
||||
),
|
||||
]
|
||||
|
||||
@@ -112,7 +112,9 @@ public struct HTTPField: Sendable, Hashable {
|
||||
///
|
||||
/// - Parameter body: The closure to be invoked with the buffer.
|
||||
/// - Returns: Result of the `body` closure.
|
||||
public func withUnsafeBytesOfValue<Result>(_ body: (UnsafeBufferPointer<UInt8>) throws -> Result) rethrows -> Result {
|
||||
public func withUnsafeBytesOfValue<Result>(
|
||||
_ body: (UnsafeBufferPointer<UInt8>) throws -> Result
|
||||
) rethrows -> Result {
|
||||
try self.rawValue.withUnsafeBytes(body)
|
||||
}
|
||||
|
||||
@@ -135,7 +137,7 @@ public struct HTTPField: Sendable, Hashable {
|
||||
switch byte {
|
||||
case 0x09, 0x20:
|
||||
break
|
||||
case 0x21 ... 0x7E, 0x80 ... 0xFF:
|
||||
case 0x21...0x7E, 0x80...0xFF:
|
||||
break
|
||||
default:
|
||||
return false
|
||||
@@ -161,13 +163,15 @@ public struct HTTPField: Sendable, Hashable {
|
||||
switch byte {
|
||||
case 0x09, 0x20:
|
||||
return byte
|
||||
case 0x21 ... 0x7E, 0x80 ... 0xFF:
|
||||
case 0x21...0x7E, 0x80...0xFF:
|
||||
return byte
|
||||
default:
|
||||
return 0x20
|
||||
}
|
||||
}
|
||||
let trimmed = bytes.reversed().drop { $0 == 0x09 || $0 == 0x20 }.reversed().drop { $0 == 0x09 || $0 == 0x20 }
|
||||
let trimmed = bytes.reversed().drop { $0 == 0x09 || $0 == 0x20 }.reversed().drop {
|
||||
$0 == 0x09 || $0 == 0x20
|
||||
}
|
||||
return ISOLatin1String(unchecked: String(decoding: trimmed, as: UTF8.self))
|
||||
}
|
||||
}
|
||||
@@ -242,11 +246,16 @@ extension HTTPField: Codable {
|
||||
let name = try container.decode(Name.self, forKey: .name)
|
||||
let value = try container.decode(String.self, forKey: .value)
|
||||
guard Self.isValidValue(value) else {
|
||||
throw DecodingError.dataCorruptedError(forKey: .value, in: container, debugDescription: "HTTP field value \"\(value)\" contains invalid characters")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
forKey: .value,
|
||||
in: container,
|
||||
debugDescription: "HTTP field value \"\(value)\" contains invalid characters"
|
||||
)
|
||||
}
|
||||
self.init(name: name, uncheckedValue: ISOLatin1String(unchecked: value))
|
||||
if let indexingStrategyValue = try container.decodeIfPresent(UInt8.self, forKey: .indexingStrategy),
|
||||
let indexingStrategy = DynamicTableIndexingStrategy(rawValue: indexingStrategyValue) {
|
||||
let indexingStrategy = DynamicTableIndexingStrategy(rawValue: indexingStrategyValue)
|
||||
{
|
||||
self.indexingStrategy = indexingStrategy
|
||||
}
|
||||
}
|
||||
@@ -254,15 +263,16 @@ extension HTTPField: Codable {
|
||||
|
||||
extension HTTPField {
|
||||
static func isValidToken(_ token: some StringProtocol) -> Bool {
|
||||
!token.isEmpty && token.utf8.allSatisfy {
|
||||
switch $0 {
|
||||
case 0x21, 0x23, 0x24, 0x25, 0x26, 0x27, 0x2A, 0x2B, 0x2D, 0x2E, 0x5E, 0x5F, 0x60, 0x7C, 0x7E:
|
||||
return true
|
||||
case 0x30 ... 0x39, 0x41 ... 0x5A, 0x61 ... 0x7A: // DIGHT, ALPHA
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
!token.isEmpty
|
||||
&& token.utf8.allSatisfy {
|
||||
switch $0 {
|
||||
case 0x21, 0x23, 0x24, 0x25, 0x26, 0x27, 0x2A, 0x2B, 0x2D, 0x2E, 0x5E, 0x5F, 0x60, 0x7C, 0x7E:
|
||||
return true
|
||||
case 0x30...0x39, 0x41...0x5A, 0x61...0x7A: // DIGHT, ALPHA
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,16 +66,18 @@ extension HTTPField {
|
||||
} else {
|
||||
token = Substring(name)
|
||||
}
|
||||
guard token.utf8.allSatisfy({
|
||||
switch $0 {
|
||||
case 0x21, 0x23, 0x24, 0x25, 0x26, 0x27, 0x2A, 0x2B, 0x2D, 0x2E, 0x5E, 0x5F, 0x60, 0x7C, 0x7E:
|
||||
return true
|
||||
case 0x30 ... 0x39, 0x61 ... 0x7A: // DIGHT, ALPHA
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}) else {
|
||||
guard
|
||||
token.utf8.allSatisfy({
|
||||
switch $0 {
|
||||
case 0x21, 0x23, 0x24, 0x25, 0x26, 0x27, 0x2A, 0x2B, 0x2D, 0x2E, 0x5E, 0x5F, 0x60, 0x7C, 0x7E:
|
||||
return true
|
||||
case 0x30...0x39, 0x61...0x7A: // DIGHT, ALPHA
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
})
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
self.rawName = name
|
||||
@@ -126,13 +128,20 @@ extension HTTPField.Name: Codable {
|
||||
let nameString = try container.decode(String.self)
|
||||
if nameString.hasPrefix(":") {
|
||||
guard nameString.lowercased() == nameString,
|
||||
HTTPField.isValidToken(nameString.dropFirst()) else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "HTTP pseudo field name \"\(nameString)\" contains invalid characters")
|
||||
HTTPField.isValidToken(nameString.dropFirst())
|
||||
else {
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "HTTP pseudo field name \"\(nameString)\" contains invalid characters"
|
||||
)
|
||||
}
|
||||
self.init(rawName: nameString, canonicalName: nameString)
|
||||
} else {
|
||||
guard let name = Self(nameString) else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "HTTP field name \"\(nameString)\" contains invalid characters")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "HTTP field name \"\(nameString)\" contains invalid characters"
|
||||
)
|
||||
}
|
||||
self = name
|
||||
}
|
||||
@@ -170,42 +179,58 @@ extension HTTPField.Name {
|
||||
/// Access-Control-Allow-Credentials
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var accessControlAllowCredentials: Self { .init(rawName: "Access-Control-Allow-Credentials", canonicalName: "access-control-allow-credentials") }
|
||||
public static var accessControlAllowCredentials: Self {
|
||||
.init(rawName: "Access-Control-Allow-Credentials", canonicalName: "access-control-allow-credentials")
|
||||
}
|
||||
|
||||
/// Access-Control-Allow-Headers
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var accessControlAllowHeaders: Self { .init(rawName: "Access-Control-Allow-Headers", canonicalName: "access-control-allow-headers") }
|
||||
public static var accessControlAllowHeaders: Self {
|
||||
.init(rawName: "Access-Control-Allow-Headers", canonicalName: "access-control-allow-headers")
|
||||
}
|
||||
|
||||
/// Access-Control-Allow-Methods
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var accessControlAllowMethods: Self { .init(rawName: "Access-Control-Allow-Methods", canonicalName: "access-control-allow-methods") }
|
||||
public static var accessControlAllowMethods: Self {
|
||||
.init(rawName: "Access-Control-Allow-Methods", canonicalName: "access-control-allow-methods")
|
||||
}
|
||||
|
||||
/// Access-Control-Allow-Origin
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var accessControlAllowOrigin: Self { .init(rawName: "Access-Control-Allow-Origin", canonicalName: "access-control-allow-origin") }
|
||||
public static var accessControlAllowOrigin: Self {
|
||||
.init(rawName: "Access-Control-Allow-Origin", canonicalName: "access-control-allow-origin")
|
||||
}
|
||||
|
||||
/// Access-Control-Expose-Headers
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var accessControlExposeHeaders: Self { .init(rawName: "Access-Control-Expose-Headers", canonicalName: "access-control-expose-headers") }
|
||||
public static var accessControlExposeHeaders: Self {
|
||||
.init(rawName: "Access-Control-Expose-Headers", canonicalName: "access-control-expose-headers")
|
||||
}
|
||||
|
||||
/// Access-Control-Max-Age
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var accessControlMaxAge: Self { .init(rawName: "Access-Control-Max-Age", canonicalName: "access-control-max-age") }
|
||||
public static var accessControlMaxAge: Self {
|
||||
.init(rawName: "Access-Control-Max-Age", canonicalName: "access-control-max-age")
|
||||
}
|
||||
|
||||
/// Access-Control-Request-Headers
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var accessControlRequestHeaders: Self { .init(rawName: "Access-Control-Request-Headers", canonicalName: "access-control-request-headers") }
|
||||
public static var accessControlRequestHeaders: Self {
|
||||
.init(rawName: "Access-Control-Request-Headers", canonicalName: "access-control-request-headers")
|
||||
}
|
||||
|
||||
/// Access-Control-Request-Method
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var accessControlRequestMethod: Self { .init(rawName: "Access-Control-Request-Method", canonicalName: "access-control-request-method") }
|
||||
public static var accessControlRequestMethod: Self {
|
||||
.init(rawName: "Access-Control-Request-Method", canonicalName: "access-control-request-method")
|
||||
}
|
||||
|
||||
/// Age
|
||||
///
|
||||
@@ -220,7 +245,9 @@ extension HTTPField.Name {
|
||||
/// Authentication-Info
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc9110.html
|
||||
public static var authenticationInfo: Self { .init(rawName: "Authentication-Info", canonicalName: "authentication-info") }
|
||||
public static var authenticationInfo: Self {
|
||||
.init(rawName: "Authentication-Info", canonicalName: "authentication-info")
|
||||
}
|
||||
|
||||
/// Authorization
|
||||
///
|
||||
@@ -240,7 +267,9 @@ extension HTTPField.Name {
|
||||
/// Content-Disposition
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc6266.html
|
||||
public static var contentDisposition: Self { .init(rawName: "Content-Disposition", canonicalName: "content-disposition") }
|
||||
public static var contentDisposition: Self {
|
||||
.init(rawName: "Content-Disposition", canonicalName: "content-disposition")
|
||||
}
|
||||
|
||||
/// Content-Encoding
|
||||
///
|
||||
@@ -270,12 +299,16 @@ extension HTTPField.Name {
|
||||
/// Content-Security-Policy
|
||||
///
|
||||
/// https://www.w3.org/TR/CSP/
|
||||
public static var contentSecurityPolicy: Self { .init(rawName: "Content-Security-Policy", canonicalName: "content-security-policy") }
|
||||
public static var contentSecurityPolicy: Self {
|
||||
.init(rawName: "Content-Security-Policy", canonicalName: "content-security-policy")
|
||||
}
|
||||
|
||||
/// Content-Security-Policy-Report-Only
|
||||
///
|
||||
/// https://www.w3.org/TR/CSP/
|
||||
public static var contentSecurityPolicyReportOnly: Self { .init(rawName: "Content-Security-Policy-Report-Only", canonicalName: "content-security-policy-report-only") }
|
||||
public static var contentSecurityPolicyReportOnly: Self {
|
||||
.init(rawName: "Content-Security-Policy-Report-Only", canonicalName: "content-security-policy-report-only")
|
||||
}
|
||||
|
||||
/// Content-Type
|
||||
///
|
||||
@@ -290,7 +323,9 @@ extension HTTPField.Name {
|
||||
/// Cross-Origin-Resource-Policy
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var crossOriginResourcePolicy: Self { .init(rawName: "Cross-Origin-Resource-Policy", canonicalName: "cross-origin-resource-policy") }
|
||||
public static var crossOriginResourcePolicy: Self {
|
||||
.init(rawName: "Cross-Origin-Resource-Policy", canonicalName: "cross-origin-resource-policy")
|
||||
}
|
||||
|
||||
/// Date
|
||||
///
|
||||
@@ -351,7 +386,9 @@ extension HTTPField.Name {
|
||||
/// If-Unmodified-Since
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc9110.html
|
||||
public static var ifUnmodifiedSince: Self { .init(rawName: "If-Unmodified-Since", canonicalName: "if-unmodified-since") }
|
||||
public static var ifUnmodifiedSince: Self {
|
||||
.init(rawName: "If-Unmodified-Since", canonicalName: "if-unmodified-since")
|
||||
}
|
||||
|
||||
/// Last-Modified
|
||||
///
|
||||
@@ -381,17 +418,23 @@ extension HTTPField.Name {
|
||||
/// Proxy-Authenticate
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc9110.html
|
||||
public static var proxyAuthenticate: Self { .init(rawName: "Proxy-Authenticate", canonicalName: "proxy-authenticate") }
|
||||
public static var proxyAuthenticate: Self {
|
||||
.init(rawName: "Proxy-Authenticate", canonicalName: "proxy-authenticate")
|
||||
}
|
||||
|
||||
/// Proxy-Authentication-Info
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc9110.html
|
||||
public static var proxyAuthenticationInfo: Self { .init(rawName: "Proxy-Authentication-Info", canonicalName: "proxy-authentication-info") }
|
||||
public static var proxyAuthenticationInfo: Self {
|
||||
.init(rawName: "Proxy-Authentication-Info", canonicalName: "proxy-authentication-info")
|
||||
}
|
||||
|
||||
/// Proxy-Authorization
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc9110.html
|
||||
public static var proxyAuthorization: Self { .init(rawName: "Proxy-Authorization", canonicalName: "proxy-authorization") }
|
||||
public static var proxyAuthorization: Self {
|
||||
.init(rawName: "Proxy-Authorization", canonicalName: "proxy-authorization")
|
||||
}
|
||||
|
||||
/// Proxy-Status
|
||||
///
|
||||
@@ -421,12 +464,16 @@ extension HTTPField.Name {
|
||||
/// Sec-WebSocket-Accept
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc6455.html
|
||||
public static var secWebSocketAccept: Self { .init(rawName: "Sec-WebSocket-Accept", canonicalName: "sec-websocket-accept") }
|
||||
public static var secWebSocketAccept: Self {
|
||||
.init(rawName: "Sec-WebSocket-Accept", canonicalName: "sec-websocket-accept")
|
||||
}
|
||||
|
||||
/// Sec-WebSocket-Extensions
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc6455.html
|
||||
public static var secWebSocketExtensions: Self { .init(rawName: "Sec-WebSocket-Extensions", canonicalName: "sec-websocket-extensions") }
|
||||
public static var secWebSocketExtensions: Self {
|
||||
.init(rawName: "Sec-WebSocket-Extensions", canonicalName: "sec-websocket-extensions")
|
||||
}
|
||||
|
||||
/// Sec-WebSocket-Key
|
||||
///
|
||||
@@ -436,12 +483,16 @@ extension HTTPField.Name {
|
||||
/// Sec-WebSocket-Protocol
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc6455.html
|
||||
public static var secWebSocketProtocol: Self { .init(rawName: "Sec-WebSocket-Protocol", canonicalName: "sec-websocket-protocol") }
|
||||
public static var secWebSocketProtocol: Self {
|
||||
.init(rawName: "Sec-WebSocket-Protocol", canonicalName: "sec-websocket-protocol")
|
||||
}
|
||||
|
||||
/// Sec-WebSocket-Version
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc6455.html
|
||||
public static var secWebSocketVersion: Self { .init(rawName: "Sec-WebSocket-Version", canonicalName: "sec-websocket-version") }
|
||||
public static var secWebSocketVersion: Self {
|
||||
.init(rawName: "Sec-WebSocket-Version", canonicalName: "sec-websocket-version")
|
||||
}
|
||||
|
||||
/// Server
|
||||
///
|
||||
@@ -456,7 +507,9 @@ extension HTTPField.Name {
|
||||
/// Strict-Transport-Security
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc6797.html
|
||||
public static var strictTransportSecurity: Self { .init(rawName: "Strict-Transport-Security", canonicalName: "strict-transport-security") }
|
||||
public static var strictTransportSecurity: Self {
|
||||
.init(rawName: "Strict-Transport-Security", canonicalName: "strict-transport-security")
|
||||
}
|
||||
|
||||
/// TE
|
||||
///
|
||||
@@ -501,7 +554,9 @@ extension HTTPField.Name {
|
||||
/// X-Content-Type-Options
|
||||
///
|
||||
/// https://fetch.spec.whatwg.org/
|
||||
public static var xContentTypeOptions: Self { .init(rawName: "X-Content-Type-Options", canonicalName: "x-content-type-options") }
|
||||
public static var xContentTypeOptions: Self {
|
||||
.init(rawName: "X-Content-Type-Options", canonicalName: "x-content-type-options")
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
/// P3P
|
||||
@@ -522,15 +577,21 @@ extension HTTPField.Name {
|
||||
/// Proxy-Connection
|
||||
static var proxyConnection: Self { .init(rawName: "Proxy-Connection", canonicalName: "proxy-connection") }
|
||||
/// Upgrade-Insecure-Requests
|
||||
static var upgradeInsecureRequests: Self { .init(rawName: "Upgrade-Insecure-Requests", canonicalName: "upgrade-insecure-requests") }
|
||||
static var upgradeInsecureRequests: Self {
|
||||
.init(rawName: "Upgrade-Insecure-Requests", canonicalName: "upgrade-insecure-requests")
|
||||
}
|
||||
/// Datagram-Flow-Id
|
||||
static var datagramFlowId: Self { .init(rawName: "Datagram-Flow-Id", canonicalName: "datagram-flow-id") }
|
||||
/// Capsule-Protocol
|
||||
static var capsuleProtocol: Self { .init(rawName: "Capsule-Protocol", canonicalName: "capsule-protocol") }
|
||||
/// Server-Connection-Id
|
||||
static var serverConnectionId: Self { .init(rawName: "Server-Connection-Id", canonicalName: "server-connection-id") }
|
||||
static var serverConnectionId: Self {
|
||||
.init(rawName: "Server-Connection-Id", canonicalName: "server-connection-id")
|
||||
}
|
||||
/// Client-Connection-Id
|
||||
static var clientConnectionId: Self { .init(rawName: "Client-Connection-Id", canonicalName: "client-connection-id") }
|
||||
static var clientConnectionId: Self {
|
||||
.init(rawName: "Client-Connection-Id", canonicalName: "client-connection-id")
|
||||
}
|
||||
/// Sec-CH-Background
|
||||
static var secCHBackground: Self { .init(rawName: "Sec-CH-Background", canonicalName: "sec-ch-background") }
|
||||
/// Sec-CH-Geohash
|
||||
@@ -538,7 +599,9 @@ extension HTTPField.Name {
|
||||
/// Client-Geohash
|
||||
static var clientGeohash: Self { .init(rawName: "Client-Geohash", canonicalName: "client-geohash") }
|
||||
/// Proxy-QUIC-Forwarding
|
||||
static var proxyQUICForwarding: Self { .init(rawName: "Proxy-QUIC-Forwarding", canonicalName: "proxy-quic-forwarding") }
|
||||
static var proxyQUICForwarding: Self {
|
||||
.init(rawName: "Proxy-QUIC-Forwarding", canonicalName: "proxy-quic-forwarding")
|
||||
}
|
||||
/// Proxy-Config-Epoch
|
||||
static var proxyConfigEpoch: Self { .init(rawName: "Proxy-Config-Epoch", canonicalName: "proxy-config-epoch") }
|
||||
/// Connect-UDP-Bind
|
||||
|
||||
@@ -133,10 +133,14 @@ public struct HTTPFields: Sendable, Hashable {
|
||||
set {
|
||||
if let newValue {
|
||||
if #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *),
|
||||
name == .cookie {
|
||||
self.setFields(newValue.split(separator: "; ", omittingEmptySubsequences: false).lazy.map {
|
||||
HTTPField(name: name, value: String($0))
|
||||
}, for: name)
|
||||
name == .cookie
|
||||
{
|
||||
self.setFields(
|
||||
newValue.split(separator: "; ", omittingEmptySubsequences: false).lazy.map {
|
||||
HTTPField(name: name, value: String($0))
|
||||
},
|
||||
for: name
|
||||
)
|
||||
} else {
|
||||
self.setFields(CollectionOfOne(HTTPField(name: name, value: newValue)), for: name)
|
||||
}
|
||||
@@ -278,7 +282,8 @@ extension HTTPFields: RangeReplaceableCollection, RandomAccessCollection, Mutabl
|
||||
}
|
||||
}
|
||||
|
||||
public mutating func replaceSubrange<C>(_ subrange: Range<Int>, with newElements: C) where C: Collection, Element == C.Element {
|
||||
public mutating func replaceSubrange<C>(_ subrange: Range<Int>, with newElements: C)
|
||||
where C: Collection, Element == C.Element {
|
||||
if !isKnownUniquelyReferenced(&self._storage) {
|
||||
self._storage = self._storage.copy()
|
||||
}
|
||||
@@ -289,10 +294,13 @@ extension HTTPFields: RangeReplaceableCollection, RandomAccessCollection, Mutabl
|
||||
}
|
||||
} else {
|
||||
self._storage.index = nil
|
||||
self._storage.fields.replaceSubrange(subrange, with: newElements.lazy.map { field in
|
||||
precondition(!field.name.isPseudo, "Pseudo header field \"\(field.name)\" disallowed")
|
||||
return (field, 0)
|
||||
})
|
||||
self._storage.fields.replaceSubrange(
|
||||
subrange,
|
||||
with: newElements.lazy.map { field in
|
||||
precondition(!field.name.isPseudo, "Pseudo header field \"\(field.name)\" disallowed")
|
||||
return (field, 0)
|
||||
}
|
||||
)
|
||||
precondition(self.count < UInt16.max, "Too many fields")
|
||||
}
|
||||
}
|
||||
@@ -326,7 +334,10 @@ extension HTTPFields: Codable {
|
||||
while !container.isAtEnd {
|
||||
let field = try container.decode(HTTPField.self)
|
||||
guard !field.name.isPseudo else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Pseudo header field \"\(field)\" disallowed")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "Pseudo header field \"\(field)\" disallowed"
|
||||
)
|
||||
}
|
||||
self.append(field)
|
||||
}
|
||||
|
||||
@@ -111,9 +111,18 @@ struct HTTPParsedFields {
|
||||
throw ParsingError.requestWithResponsePseudo
|
||||
}
|
||||
try self.validateFields()
|
||||
var request = HTTPRequest(method: requestMethod, scheme: self.scheme, authority: self.authority, path: self.path, headerFields: self.fields)
|
||||
var request = HTTPRequest(
|
||||
method: requestMethod,
|
||||
scheme: self.scheme,
|
||||
authority: self.authority,
|
||||
path: self.path,
|
||||
headerFields: self.fields
|
||||
)
|
||||
if let extendedConnectProtocol = self.extendedConnectProtocol {
|
||||
request.pseudoHeaderFields.extendedConnectProtocol = HTTPField(name: .protocol, uncheckedValue: extendedConnectProtocol)
|
||||
request.pseudoHeaderFields.extendedConnectProtocol = HTTPField(
|
||||
name: .protocol,
|
||||
uncheckedValue: extendedConnectProtocol
|
||||
)
|
||||
}
|
||||
return request
|
||||
}
|
||||
@@ -124,7 +133,9 @@ struct HTTPParsedFields {
|
||||
guard let statusString = self.status?._storage else {
|
||||
throw ParsingError.responseWithoutStatus
|
||||
}
|
||||
if self.method != nil || self.scheme != nil || self.authority != nil || self.path != nil || self.extendedConnectProtocol != nil {
|
||||
if self.method != nil || self.scheme != nil || self.authority != nil || self.path != nil
|
||||
|| self.extendedConnectProtocol != nil
|
||||
{
|
||||
throw ParsingError.responseWithRequestPseudo
|
||||
}
|
||||
if !HTTPResponse.Status.isValidStatus(statusString) {
|
||||
@@ -137,7 +148,9 @@ struct HTTPParsedFields {
|
||||
|
||||
var trailerFields: HTTPFields {
|
||||
get throws {
|
||||
if self.method != nil || self.scheme != nil || self.authority != nil || self.path != nil || self.extendedConnectProtocol != nil || self.status != nil {
|
||||
if self.method != nil || self.scheme != nil || self.authority != nil || self.path != nil
|
||||
|| self.extendedConnectProtocol != nil || self.status != nil
|
||||
{
|
||||
throw ParsingError.trailerFieldsWithPseudo
|
||||
}
|
||||
try self.validateFields()
|
||||
@@ -147,12 +160,23 @@ struct HTTPParsedFields {
|
||||
}
|
||||
|
||||
extension HTTPRequest {
|
||||
fileprivate init(method: Method, scheme: ISOLatin1String?, authority: ISOLatin1String?, path: ISOLatin1String?, headerFields: HTTPFields) {
|
||||
fileprivate init(
|
||||
method: Method,
|
||||
scheme: ISOLatin1String?,
|
||||
authority: ISOLatin1String?,
|
||||
path: ISOLatin1String?,
|
||||
headerFields: HTTPFields
|
||||
) {
|
||||
let methodField = HTTPField(name: .method, uncheckedValue: ISOLatin1String(unchecked: method.rawValue))
|
||||
let schemeField = scheme.map { HTTPField(name: .scheme, uncheckedValue: $0) }
|
||||
let authorityField = authority.map { HTTPField(name: .authority, uncheckedValue: $0) }
|
||||
let pathField = path.map { HTTPField(name: .path, uncheckedValue: $0) }
|
||||
self.pseudoHeaderFields = .init(method: methodField, scheme: schemeField, authority: authorityField, path: pathField)
|
||||
self.pseudoHeaderFields = .init(
|
||||
method: methodField,
|
||||
scheme: schemeField,
|
||||
authority: authorityField,
|
||||
path: pathField
|
||||
)
|
||||
self.headerFields = headerFields
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,12 @@ public struct HTTPRequest: Sendable, Hashable {
|
||||
let schemeField = scheme.map { HTTPField(name: .scheme, value: $0) }
|
||||
let authorityField = authority.map { HTTPField(name: .authority, value: $0) }
|
||||
let pathField = path.map { HTTPField(name: .path, value: $0) }
|
||||
self.pseudoHeaderFields = .init(method: methodField, scheme: schemeField, authority: authorityField, path: pathField)
|
||||
self.pseudoHeaderFields = .init(
|
||||
method: methodField,
|
||||
scheme: schemeField,
|
||||
authority: authorityField,
|
||||
path: pathField
|
||||
)
|
||||
self.headerFields = headerFields
|
||||
}
|
||||
}
|
||||
@@ -254,40 +259,64 @@ extension HTTPRequest.PseudoHeaderFields: Codable {
|
||||
switch field.name {
|
||||
case .method:
|
||||
guard method == nil else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Multiple \":method\" pseudo header fields")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "Multiple \":method\" pseudo header fields"
|
||||
)
|
||||
}
|
||||
method = field
|
||||
case .scheme:
|
||||
guard scheme == nil else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Multiple \":scheme\" pseudo header fields")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "Multiple \":scheme\" pseudo header fields"
|
||||
)
|
||||
}
|
||||
scheme = field
|
||||
case .authority:
|
||||
guard authority == nil else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Multiple \":authority\" pseudo header fields")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "Multiple \":authority\" pseudo header fields"
|
||||
)
|
||||
}
|
||||
authority = field
|
||||
case .path:
|
||||
guard path == nil else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Multiple \":path\" pseudo header fields")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "Multiple \":path\" pseudo header fields"
|
||||
)
|
||||
}
|
||||
path = field
|
||||
case .protocol:
|
||||
guard extendedConnectProtocol == nil else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Multiple \":protocol\" pseudo header fields")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "Multiple \":protocol\" pseudo header fields"
|
||||
)
|
||||
}
|
||||
extendedConnectProtocol = field
|
||||
default:
|
||||
guard field.name.rawName.hasPrefix(":") else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "\"\(field)\" is not a pseudo header field")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "\"\(field)\" is not a pseudo header field"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
guard let method else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "\":method\" pseudo header field is missing")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "\":method\" pseudo header field is missing"
|
||||
)
|
||||
}
|
||||
guard HTTPField.isValidToken(method.rawValue._storage) else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "\"\(method.rawValue._storage)\" is not a valid method")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "\"\(method.rawValue._storage)\" is not a valid method"
|
||||
)
|
||||
}
|
||||
self.init(
|
||||
method: method,
|
||||
|
||||
@@ -33,7 +33,7 @@ public struct HTTPResponse: Sendable, Hashable {
|
||||
/// characters not representable in ISO Latin 1 encoding, are converted
|
||||
/// into space characters.
|
||||
public init(code: Int, reasonPhrase: String = "") {
|
||||
precondition((0 ... 999).contains(code), "Invalid status code")
|
||||
precondition((0...999).contains(code), "Invalid status code")
|
||||
self.code = code
|
||||
self.reasonPhrase = Self.legalizingReasonPhrase(reasonPhrase)
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public struct HTTPResponse: Sendable, Hashable {
|
||||
/// Create a custom status from an integer literal.
|
||||
/// - Parameter value: The status code.
|
||||
public init(integerLiteral value: Int) {
|
||||
precondition((0 ... 999).contains(value), "Invalid status code")
|
||||
precondition((0...999).contains(value), "Invalid status code")
|
||||
self.code = value
|
||||
self.reasonPhrase = ""
|
||||
}
|
||||
@@ -70,15 +70,15 @@ public struct HTTPResponse: Sendable, Hashable {
|
||||
/// The kind of the status code.
|
||||
public var kind: Kind {
|
||||
switch self.code {
|
||||
case 100 ... 199:
|
||||
case 100...199:
|
||||
return .informational
|
||||
case 200 ... 299:
|
||||
case 200...299:
|
||||
return .successful
|
||||
case 300 ... 399:
|
||||
case 300...399:
|
||||
return .redirection
|
||||
case 400 ... 499:
|
||||
case 400...499:
|
||||
return .clientError
|
||||
case 500 ... 599:
|
||||
case 500...599:
|
||||
return .serverError
|
||||
default:
|
||||
return .invalid
|
||||
@@ -115,7 +115,7 @@ public struct HTTPResponse: Sendable, Hashable {
|
||||
}
|
||||
|
||||
static func isValidStatus(_ status: String) -> Bool {
|
||||
status.count == 3 && status.utf8.allSatisfy { (0x30 ... 0x39).contains($0) }
|
||||
status.count == 3 && status.utf8.allSatisfy { (0x30...0x39).contains($0) }
|
||||
}
|
||||
|
||||
static func isValidReasonPhrase(_ reasonPhrase: String) -> Bool {
|
||||
@@ -123,7 +123,7 @@ public struct HTTPResponse: Sendable, Hashable {
|
||||
switch $0 {
|
||||
case 0x09, 0x20:
|
||||
return true
|
||||
case 0x21 ... 0x7E, 0x80 ... 0xFF:
|
||||
case 0x21...0x7E, 0x80...0xFF:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
@@ -139,7 +139,7 @@ public struct HTTPResponse: Sendable, Hashable {
|
||||
switch scala.value {
|
||||
case 0x09, 0x20:
|
||||
return scala
|
||||
case 0x21 ... 0x7E, 0x80 ... 0xFF:
|
||||
case 0x21...0x7E, 0x80...0xFF:
|
||||
return scala
|
||||
default:
|
||||
return " "
|
||||
@@ -159,9 +159,9 @@ public struct HTTPResponse: Sendable, Hashable {
|
||||
public var status: Status {
|
||||
get {
|
||||
var codeIterator = self.pseudoHeaderFields.status.rawValue._storage.utf8.makeIterator()
|
||||
let code = Int(codeIterator.next()! - 48) * 100 +
|
||||
Int(codeIterator.next()! - 48) * 10 +
|
||||
Int(codeIterator.next()! - 48)
|
||||
let code =
|
||||
Int(codeIterator.next()! - 48) * 100 + Int(codeIterator.next()! - 48) * 10
|
||||
+ Int(codeIterator.next()! - 48)
|
||||
return Status(uncheckedCode: code, reasonPhrase: self.reasonPhrase)
|
||||
}
|
||||
set {
|
||||
@@ -232,20 +232,32 @@ extension HTTPResponse.PseudoHeaderFields: Codable {
|
||||
switch field.name {
|
||||
case .status:
|
||||
guard status == nil else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "Multiple \":status\" pseudo header fields")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "Multiple \":status\" pseudo header fields"
|
||||
)
|
||||
}
|
||||
status = field
|
||||
default:
|
||||
guard field.name.rawName.hasPrefix(":") else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "\"\(field)\" is not a pseudo header field")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "\"\(field)\" is not a pseudo header field"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
guard let status else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "\":status\" pseudo header field is missing")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "\":status\" pseudo header field is missing"
|
||||
)
|
||||
}
|
||||
guard HTTPResponse.Status.isValidStatus(status.rawValue._storage) else {
|
||||
throw DecodingError.dataCorruptedError(in: container, debugDescription: "\"\(status.rawValue._storage)\" is not a valid status code")
|
||||
throw DecodingError.dataCorruptedError(
|
||||
in: container,
|
||||
debugDescription: "\"\(status.rawValue._storage)\" is not a valid status code"
|
||||
)
|
||||
}
|
||||
self.init(status: status)
|
||||
}
|
||||
@@ -319,7 +331,9 @@ extension HTTPResponse.Status {
|
||||
/// 203 Non-Authoritative Information
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc9110.html
|
||||
public static var nonAuthoritativeInformation: Self { .init(uncheckedCode: 203, reasonPhrase: "Non-Authoritative Information") }
|
||||
public static var nonAuthoritativeInformation: Self {
|
||||
.init(uncheckedCode: 203, reasonPhrase: "Non-Authoritative Information")
|
||||
}
|
||||
|
||||
/// 204 No Content
|
||||
///
|
||||
@@ -408,7 +422,9 @@ extension HTTPResponse.Status {
|
||||
/// 407 Proxy Authentication Required
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc9110.html
|
||||
public static var proxyAuthenticationRequired: Self { .init(uncheckedCode: 407, reasonPhrase: "Proxy Authentication Required") }
|
||||
public static var proxyAuthenticationRequired: Self {
|
||||
.init(uncheckedCode: 407, reasonPhrase: "Proxy Authentication Required")
|
||||
}
|
||||
|
||||
/// 408 Request Timeout
|
||||
///
|
||||
@@ -491,12 +507,16 @@ extension HTTPResponse.Status {
|
||||
/// 431 Request Header Fields Too Large
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc6585.html
|
||||
public static var requestHeaderFieldsTooLarge: Self { .init(uncheckedCode: 431, reasonPhrase: "Request Header Fields Too Large") }
|
||||
public static var requestHeaderFieldsTooLarge: Self {
|
||||
.init(uncheckedCode: 431, reasonPhrase: "Request Header Fields Too Large")
|
||||
}
|
||||
|
||||
/// 451 Unavailable For Legal Reasons
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc7725.html
|
||||
public static var unavailableForLegalReasons: Self { .init(uncheckedCode: 451, reasonPhrase: "Unavailable For Legal Reasons") }
|
||||
public static var unavailableForLegalReasons: Self {
|
||||
.init(uncheckedCode: 451, reasonPhrase: "Unavailable For Legal Reasons")
|
||||
}
|
||||
|
||||
// MARK: 5xx
|
||||
|
||||
@@ -528,10 +548,14 @@ extension HTTPResponse.Status {
|
||||
/// 505 HTTP Version Not Supported
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc9110.html
|
||||
public static var httpVersionNotSupported: Self { .init(uncheckedCode: 505, reasonPhrase: "HTTP Version Not Supported") }
|
||||
public static var httpVersionNotSupported: Self {
|
||||
.init(uncheckedCode: 505, reasonPhrase: "HTTP Version Not Supported")
|
||||
}
|
||||
|
||||
/// 511 Network Authentication Required
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc6585.html
|
||||
public static var networkAuthenticationRequired: Self { .init(uncheckedCode: 511, reasonPhrase: "Network Authentication Required") }
|
||||
public static var networkAuthenticationRequired: Self {
|
||||
.init(uncheckedCode: 511, reasonPhrase: "Network Authentication Required")
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,9 @@ struct ISOLatin1String: Sendable, Hashable {
|
||||
return string
|
||||
}
|
||||
|
||||
private func withISOLatin1BytesSlowPath<Result>(_ body: (UnsafeBufferPointer<UInt8>) throws -> Result) rethrows -> Result {
|
||||
private func withISOLatin1BytesSlowPath<Result>(
|
||||
_ body: (UnsafeBufferPointer<UInt8>) throws -> Result
|
||||
) rethrows -> Result {
|
||||
try withUnsafeTemporaryAllocation(of: UInt8.self, capacity: self._storage.unicodeScalars.count) { buffer in
|
||||
for (index, scalar) in self._storage.unicodeScalars.enumerated() {
|
||||
assert(scalar.value <= UInt8.max)
|
||||
|
||||
@@ -22,8 +22,9 @@ extension HTTPRequest {
|
||||
public var url: URL? {
|
||||
get {
|
||||
if let schemeField = self.pseudoHeaderFields.scheme,
|
||||
let authorityField = self.pseudoHeaderFields.authority,
|
||||
let pathField = self.pseudoHeaderFields.path {
|
||||
let authorityField = self.pseudoHeaderFields.authority,
|
||||
let pathField = self.pseudoHeaderFields.path
|
||||
{
|
||||
return schemeField.withUnsafeBytesOfValue { scheme in
|
||||
authorityField.withUnsafeBytesOfValue { authority in
|
||||
pathField.withUnsafeBytesOfValue { path in
|
||||
@@ -60,7 +61,13 @@ extension HTTPRequest {
|
||||
let authorityString = authority.map { String(decoding: $0, as: UTF8.self) }
|
||||
let pathString = String(decoding: path, as: UTF8.self)
|
||||
|
||||
self.init(method: method, scheme: schemeString, authority: authorityString, path: pathString, headerFields: headerFields)
|
||||
self.init(
|
||||
method: method,
|
||||
scheme: schemeString,
|
||||
authority: authorityString,
|
||||
path: pathString,
|
||||
headerFields: headerFields
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +81,14 @@ extension URL {
|
||||
buffer.append(contentsOf: path)
|
||||
|
||||
if let url = buffer.withUnsafeBytes({ buffer in
|
||||
CFURLCreateAbsoluteURLWithBytes(kCFAllocatorDefault, buffer.baseAddress, buffer.count, CFStringBuiltInEncodings.ASCII.rawValue, nil, false).map { unsafeBitCast($0, to: NSURL.self) as URL }
|
||||
CFURLCreateAbsoluteURLWithBytes(
|
||||
kCFAllocatorDefault,
|
||||
buffer.baseAddress,
|
||||
buffer.count,
|
||||
CFStringBuiltInEncodings.ASCII.rawValue,
|
||||
nil,
|
||||
false
|
||||
).map { unsafeBitCast($0, to: NSURL.self) as URL }
|
||||
}) {
|
||||
self = url
|
||||
} else {
|
||||
@@ -96,7 +110,7 @@ extension URL {
|
||||
}
|
||||
|
||||
func bufferSlice(_ range: CFRange) -> UnsafeMutableBufferPointer<UInt8> {
|
||||
UnsafeMutableBufferPointer(rebasing: buffer[range.location ..< range.location + range.length])
|
||||
UnsafeMutableBufferPointer(rebasing: buffer[range.location..<range.location + range.length])
|
||||
}
|
||||
|
||||
let schemeRange = CFURLGetByteRangeForComponent(url, .scheme, nil)
|
||||
@@ -124,7 +138,9 @@ extension URL {
|
||||
let pathBuffer = bufferSlice(requestPathRange)
|
||||
path = [UInt8](unsafeUninitializedCapacity: pathBuffer.count + 1) { buffer, initializedCount in
|
||||
buffer[0] = 0x2F
|
||||
UnsafeMutableRawBufferPointer(UnsafeMutableBufferPointer(rebasing: buffer[1...])).copyMemory(from: UnsafeRawBufferPointer(pathBuffer))
|
||||
UnsafeMutableRawBufferPointer(UnsafeMutableBufferPointer(rebasing: buffer[1...])).copyMemory(
|
||||
from: UnsafeRawBufferPointer(pathBuffer)
|
||||
)
|
||||
initializedCount = pathBuffer.count + 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ extension HTTPField {
|
||||
if isoLatin1Value.isASCII {
|
||||
self.init(name: name, value: isoLatin1Value)
|
||||
} else {
|
||||
self = withUnsafeTemporaryAllocation(of: UInt8.self, capacity: isoLatin1Value.unicodeScalars.count) { buffer in
|
||||
self = withUnsafeTemporaryAllocation(of: UInt8.self, capacity: isoLatin1Value.unicodeScalars.count) {
|
||||
buffer in
|
||||
for (index, scalar) in isoLatin1Value.unicodeScalars.enumerated() {
|
||||
if scalar.value > UInt8.max {
|
||||
buffer[index] = 0x20
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
import Foundation
|
||||
import HTTPTypes
|
||||
|
||||
#if canImport(FoundationNetworking)
|
||||
import FoundationNetworking
|
||||
#endif
|
||||
@@ -49,7 +50,7 @@ extension URLRequest {
|
||||
/// Convert the `URLRequest` into an `HTTPRequest`.
|
||||
public var httpRequest: HTTPRequest? {
|
||||
guard let method = HTTPRequest.Method(self.httpMethod ?? "GET"),
|
||||
let url
|
||||
let url
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
import Foundation
|
||||
import HTTPTypes
|
||||
|
||||
#if canImport(FoundationNetworking)
|
||||
import FoundationNetworking
|
||||
#endif
|
||||
@@ -42,7 +43,7 @@ extension HTTPURLResponse {
|
||||
|
||||
/// Convert the `HTTPURLResponse` into an `HTTPResponse`.
|
||||
public var httpResponse: HTTPResponse? {
|
||||
guard (0 ... 999).contains(self.statusCode) else {
|
||||
guard (0...999).contains(self.statusCode) else {
|
||||
return nil
|
||||
}
|
||||
var response = HTTPResponse(status: .init(code: self.statusCode))
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
import Foundation
|
||||
import HTTPTypes
|
||||
|
||||
#if canImport(FoundationNetworking)
|
||||
import FoundationNetworking
|
||||
#endif
|
||||
@@ -44,7 +45,7 @@ private enum HTTPTypeConversionError: Error {
|
||||
|
||||
#endif
|
||||
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) || compiler(>=6)
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || compiler(>=6) || (compiler(>=6) && os(visionOS))
|
||||
|
||||
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
|
||||
extension URLSession {
|
||||
@@ -53,7 +54,10 @@ extension URLSession {
|
||||
/// - Parameter request: The `HTTPRequest` for which to load data.
|
||||
/// - Parameter delegate: Task-specific delegate.
|
||||
/// - Returns: Data and response.
|
||||
public func data(for request: HTTPRequest, delegate: URLSessionTaskDelegate? = nil) async throws -> (Data, HTTPResponse) {
|
||||
public func data(
|
||||
for request: HTTPRequest,
|
||||
delegate: URLSessionTaskDelegate? = nil
|
||||
) async throws -> (Data, HTTPResponse) {
|
||||
guard let urlRequest = URLRequest(httpRequest: request) else {
|
||||
throw HTTPTypeConversionError.failedToConvertHTTPRequestToURLRequest
|
||||
}
|
||||
@@ -70,7 +74,11 @@ extension URLSession {
|
||||
/// - Parameter fileURL: File to upload.
|
||||
/// - Parameter delegate: Task-specific delegate.
|
||||
/// - Returns: Data and response.
|
||||
public func upload(for request: HTTPRequest, fromFile fileURL: URL, delegate: URLSessionTaskDelegate? = nil) async throws -> (Data, HTTPResponse) {
|
||||
public func upload(
|
||||
for request: HTTPRequest,
|
||||
fromFile fileURL: URL,
|
||||
delegate: URLSessionTaskDelegate? = nil
|
||||
) async throws -> (Data, HTTPResponse) {
|
||||
guard let urlRequest = URLRequest(httpRequest: request) else {
|
||||
throw HTTPTypeConversionError.failedToConvertHTTPRequestToURLRequest
|
||||
}
|
||||
@@ -87,7 +95,11 @@ extension URLSession {
|
||||
/// - Parameter bodyData: Data to upload.
|
||||
/// - Parameter delegate: Task-specific delegate.
|
||||
/// - Returns: Data and response.
|
||||
public func upload(for request: HTTPRequest, from bodyData: Data, delegate: URLSessionTaskDelegate? = nil) async throws -> (Data, HTTPResponse) {
|
||||
public func upload(
|
||||
for request: HTTPRequest,
|
||||
from bodyData: Data,
|
||||
delegate: URLSessionTaskDelegate? = nil
|
||||
) async throws -> (Data, HTTPResponse) {
|
||||
guard let urlRequest = URLRequest(httpRequest: request) else {
|
||||
throw HTTPTypeConversionError.failedToConvertHTTPRequestToURLRequest
|
||||
}
|
||||
@@ -103,7 +115,10 @@ extension URLSession {
|
||||
/// - Parameter request: The `HTTPRequest` for which to download.
|
||||
/// - Parameter delegate: Task-specific delegate.
|
||||
/// - Returns: Downloaded file URL and response. The file will not be removed automatically.
|
||||
public func download(for request: HTTPRequest, delegate: URLSessionTaskDelegate? = nil) async throws -> (URL, HTTPResponse) {
|
||||
public func download(
|
||||
for request: HTTPRequest,
|
||||
delegate: URLSessionTaskDelegate? = nil
|
||||
) async throws -> (URL, HTTPResponse) {
|
||||
guard let urlRequest = URLRequest(httpRequest: request) else {
|
||||
throw HTTPTypeConversionError.failedToConvertHTTPRequestToURLRequest
|
||||
}
|
||||
@@ -114,13 +129,16 @@ extension URLSession {
|
||||
return (location, response)
|
||||
}
|
||||
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || (compiler(>=6) && os(visionOS))
|
||||
/// Returns a byte stream that conforms to AsyncSequence protocol.
|
||||
///
|
||||
/// - Parameter request: The `HTTPRequest` for which to load data.
|
||||
/// - Parameter delegate: Task-specific delegate.
|
||||
/// - Returns: Data stream and response.
|
||||
public func bytes(for request: HTTPRequest, delegate: URLSessionTaskDelegate? = nil) async throws -> (AsyncBytes, HTTPResponse) {
|
||||
public func bytes(
|
||||
for request: HTTPRequest,
|
||||
delegate: URLSessionTaskDelegate? = nil
|
||||
) async throws -> (AsyncBytes, HTTPResponse) {
|
||||
guard let urlRequest = URLRequest(httpRequest: request) else {
|
||||
throw HTTPTypeConversionError.failedToConvertHTTPRequestToURLRequest
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
import HTTPTypes
|
||||
import HTTPTypesFoundation
|
||||
import XCTest
|
||||
|
||||
#if canImport(FoundationNetworking)
|
||||
import FoundationNetworking
|
||||
#endif
|
||||
@@ -54,7 +55,10 @@ final class HTTPTypesFoundationTests: XCTestCase {
|
||||
|
||||
func testRequestToFoundation() throws {
|
||||
let request = HTTPRequest(
|
||||
method: .get, scheme: "https", authority: "www.example.com", path: "/",
|
||||
method: .get,
|
||||
scheme: "https",
|
||||
authority: "www.example.com",
|
||||
path: "/",
|
||||
headerFields: [
|
||||
.accept: "*/*",
|
||||
.acceptEncoding: "gzip",
|
||||
@@ -88,20 +92,24 @@ final class HTTPTypesFoundationTests: XCTestCase {
|
||||
let response = HTTPResponse(
|
||||
status: .ok,
|
||||
headerFields: [
|
||||
.server: "HTTPServer/1.0",
|
||||
.server: "HTTPServer/1.0"
|
||||
]
|
||||
)
|
||||
|
||||
let urlResponse = try XCTUnwrap(HTTPURLResponse(httpResponse: response, url: URL(string: "https://www.example.com/")!))
|
||||
let urlResponse = try XCTUnwrap(
|
||||
HTTPURLResponse(httpResponse: response, url: URL(string: "https://www.example.com/")!)
|
||||
)
|
||||
XCTAssertEqual(urlResponse.statusCode, 200)
|
||||
XCTAssertEqual(urlResponse.value(forHTTPHeaderField: "Server"), "HTTPServer/1.0")
|
||||
}
|
||||
|
||||
func testResponseFromFoundation() throws {
|
||||
let urlResponse = HTTPURLResponse(
|
||||
url: URL(string: "https://www.example.com/")!, statusCode: 204, httpVersion: nil,
|
||||
url: URL(string: "https://www.example.com/")!,
|
||||
statusCode: 204,
|
||||
httpVersion: nil,
|
||||
headerFields: [
|
||||
"X-Emoji": "ð",
|
||||
"X-Emoji": "ð"
|
||||
]
|
||||
)!
|
||||
|
||||
|
||||
@@ -44,9 +44,14 @@ final class HTTPTypesTests: XCTestCase {
|
||||
func testRequest() {
|
||||
var request1 = HTTPRequest(method: .get, scheme: "https", authority: "www.example.com", path: "/")
|
||||
request1.headerFields = [
|
||||
.acceptLanguage: "en",
|
||||
.acceptLanguage: "en"
|
||||
]
|
||||
var request2 = HTTPRequest(method: HTTPRequest.Method("GET")!, scheme: "https", authority: "www.example.com", path: "/")
|
||||
var request2 = HTTPRequest(
|
||||
method: HTTPRequest.Method("GET")!,
|
||||
scheme: "https",
|
||||
authority: "www.example.com",
|
||||
path: "/"
|
||||
)
|
||||
request2.headerFields.append(HTTPField(name: .acceptLanguageUpper, value: "en"))
|
||||
|
||||
XCTAssertEqual(request2.method, .get)
|
||||
@@ -145,49 +150,64 @@ final class HTTPTypesTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testRequestCoding() throws {
|
||||
let request = HTTPRequest(method: .put, scheme: "https", authority: "www.example.com", path: "/upload", headerFields: [
|
||||
.acceptEncoding: "br",
|
||||
.acceptEncoding: "gzip",
|
||||
.contentLength: "1024",
|
||||
])
|
||||
let request = HTTPRequest(
|
||||
method: .put,
|
||||
scheme: "https",
|
||||
authority: "www.example.com",
|
||||
path: "/upload",
|
||||
headerFields: [
|
||||
.acceptEncoding: "br",
|
||||
.acceptEncoding: "gzip",
|
||||
.contentLength: "1024",
|
||||
]
|
||||
)
|
||||
let encoded = try JSONEncoder().encode(request)
|
||||
|
||||
let json = try JSONSerialization.jsonObject(with: encoded)
|
||||
XCTAssertEqual(json as? NSDictionary, [
|
||||
"pseudoHeaderFields": [
|
||||
["name": ":method", "value": "PUT"],
|
||||
["name": ":scheme", "value": "https"],
|
||||
["name": ":authority", "value": "www.example.com"],
|
||||
["name": ":path", "value": "/upload"],
|
||||
],
|
||||
"headerFields": [
|
||||
["name": "Accept-Encoding", "value": "br"],
|
||||
["name": "Accept-Encoding", "value": "gzip"],
|
||||
["name": "Content-Length", "value": "1024"],
|
||||
],
|
||||
])
|
||||
XCTAssertEqual(
|
||||
json as? NSDictionary,
|
||||
[
|
||||
"pseudoHeaderFields": [
|
||||
["name": ":method", "value": "PUT"],
|
||||
["name": ":scheme", "value": "https"],
|
||||
["name": ":authority", "value": "www.example.com"],
|
||||
["name": ":path", "value": "/upload"],
|
||||
],
|
||||
"headerFields": [
|
||||
["name": "Accept-Encoding", "value": "br"],
|
||||
["name": "Accept-Encoding", "value": "gzip"],
|
||||
["name": "Content-Length", "value": "1024"],
|
||||
],
|
||||
]
|
||||
)
|
||||
|
||||
let decoded = try JSONDecoder().decode(HTTPRequest.self, from: encoded)
|
||||
XCTAssertEqual(request, decoded)
|
||||
}
|
||||
|
||||
func testResponseCoding() throws {
|
||||
var response = HTTPResponse(status: .noContent, headerFields: [
|
||||
.server: "HTTPServer/1.0",
|
||||
])
|
||||
var response = HTTPResponse(
|
||||
status: .noContent,
|
||||
headerFields: [
|
||||
.server: "HTTPServer/1.0"
|
||||
]
|
||||
)
|
||||
response.headerFields[0].indexingStrategy = .prefer
|
||||
let encoded = try JSONEncoder().encode(response)
|
||||
|
||||
let json = try JSONSerialization.jsonObject(with: encoded)
|
||||
XCTAssertEqual(json as? NSDictionary, [
|
||||
"pseudoHeaderFields": [
|
||||
["name": ":status", "value": "204"],
|
||||
],
|
||||
"reasonPhrase": "No Content",
|
||||
"headerFields": [
|
||||
["name": "Server", "value": "HTTPServer/1.0", "indexingStrategy": 1],
|
||||
],
|
||||
])
|
||||
XCTAssertEqual(
|
||||
json as? NSDictionary,
|
||||
[
|
||||
"pseudoHeaderFields": [
|
||||
["name": ":status", "value": "204"]
|
||||
],
|
||||
"reasonPhrase": "No Content",
|
||||
"headerFields": [
|
||||
["name": "Server", "value": "HTTPServer/1.0", "indexingStrategy": 1]
|
||||
],
|
||||
]
|
||||
)
|
||||
|
||||
let decoded = try JSONDecoder().decode(HTTPResponse.self, from: encoded)
|
||||
XCTAssertEqual(response, decoded)
|
||||
|
||||
@@ -13,4 +13,4 @@
|
||||
##
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
swift package --disable-sandbox preview-documentation --target $1
|
||||
swift package --disable-sandbox preview-documentation --target "$1"
|
||||
Reference in new issue
Block a user