diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1569b18..64daa5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: name: macOS runs-on: firebreak env: - DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer timeout-minutes: 10 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6c8415..6aa0369 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: name: Upload Release Artifact runs-on: firebreak env: - DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer steps: - name: Checkout uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d2979..1113f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,19 @@ All notable changes to this project will be documented in this file. - `0.x` Releases - [0.1.0](#010) | [0.2.0](#020) | [0.3.0](#030) | [0.4.0](#040) | [0.5.0](#050) [0.6.0](#060) | [0.6.1](#061) | [0.7.0](#070) | [0.8.0](#080) | [0.8.1](#081) [0.8.2](#082) | [0.8.3](#083) | [0.9.0](#090) | [0.9.1](#091) | [0.10.0](#0100) | [0.10.1](#0101) - [0.10.2](#0102) | [0.10.3](#01003) + [0.10.2](#0102) | [0.10.3](#01003) | [0.10.4](#01004) --- +## [0.10.4](https://github.com/Alamofire/Firewalk/releases/tag/0.10.4) + +Released on 2023-01-27. + +#### Updated + +- Dependencies. + - Updated by [Jon Shier](https://github.com/jshier) in PR [#36](https://github.com/Alamofire/Firewalk/pull/36). + ## [0.10.3](https://github.com/Alamofire/Firewalk/releases/tag/0.10.3) Released on 2023-11-07. diff --git a/Package.resolved b/Package.resolved index d353e9b..ef85caa 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/swift-server/async-http-client.git", "state" : { - "revision" : "16f7e62c08c6969899ce6cc277041e868364e5cf", - "version" : "1.19.0" + "revision" : "291438696abdd48d2a83b52465c176efbd94512b", + "version" : "1.20.1" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/console-kit.git", "state" : { - "revision" : "f4ef965dadd999f7e4687053153c97b8b320819c", - "version" : "4.10.1" + "revision" : "a31f44ebfbd15a2cc0fda705279676773ac16355", + "version" : "4.14.1" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/multipart-kit.git", "state" : { - "revision" : "1adfd69df2da08f7931d4281b257475e32c96734", - "version" : "4.5.4" + "revision" : "12ee56f25bd3fc4c2d09c2aa16e69de61dc786e8", + "version" : "4.6.0" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/routing-kit.git", "state" : { - "revision" : "17a7a3facce8285fd257aa7c72d5e480351e7698", - "version" : "4.8.2" + "revision" : "2a92a7eac411a82fb3a03731be5e76773ebe1b3e", + "version" : "4.9.0" } }, { @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-algorithms.git", "state" : { - "revision" : "bcd4f369ac962bc3e5244c9df778739f8f5bdbf1", - "version" : "1.1.0" + "revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42", + "version" : "1.2.0" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-collections.git", "state" : { - "revision" : "a902f1823a7ff3c9ab2fba0f992396b948eda307", - "version" : "1.0.5" + "revision" : "d029d9d39c87bed85b1c50adee7c41795261a192", + "version" : "1.0.6" } }, { @@ -77,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "b51f1d6845b353a2121de1c6a670738ec33561a6", - "version" : "3.1.0" + "revision" : "cc76b894169a3c86b71bac10c78a4db6beb7a9ad", + "version" : "3.2.0" } }, { @@ -86,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-http-types", "state" : { - "revision" : "99d066e29effa8845e4761dd3f2f831edfdf8925", - "version" : "1.0.0" + "revision" : "12358d55a3824bd5fed310b999ea8cf83a9a1a65", + "version" : "1.0.3" } }, { @@ -95,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed", - "version" : "1.5.3" + "revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5", + "version" : "1.5.4" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio.git", "state" : { - "revision" : "853522d90871b4b63262843196685795b5008c46", - "version" : "2.61.1" + "revision" : "635b2589494c97e48c62514bc8b37ced762e0a62", + "version" : "2.63.0" } }, { @@ -122,8 +122,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-extras.git", "state" : { - "revision" : "798c962495593a23fdea0c0c63fd55571d8dff51", - "version" : "1.20.0" + "revision" : "363da63c1966405764f380c627409b2f9d9e710b", + "version" : "1.21.0" } }, { @@ -131,8 +131,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-http2.git", "state" : { - "revision" : "3bd9004b9d685ed6b629760fc84903e48efec806", - "version" : "1.29.0" + "revision" : "0904bf0feb5122b7e5c3f15db7df0eabe623dd87", + "version" : "1.30.0" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-ssl.git", "state" : { - "revision" : "320bd978cceb8e88c125dcbb774943a92f6286e9", - "version" : "2.25.0" + "revision" : "7c381eb6083542b124a6c18fae742f55001dc2b5", + "version" : "2.26.0" } }, { @@ -149,8 +149,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-transport-services.git", "state" : { - "revision" : "ebf8b9c365a6ce043bf6e6326a04b15589bd285e", - "version" : "1.20.0" + "revision" : "6cbe0ed2b394f21ab0d46b9f0c50c6be964968ce", + "version" : "1.20.1" } }, { @@ -162,13 +162,22 @@ "version" : "1.0.2" } }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system.git", + "state" : { + "revision" : "025bcb1165deab2e20d4eaba79967ce73013f496", + "version" : "1.2.1" + } + }, { "identity" : "vapor", "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/vapor.git", "state" : { - "revision" : "d682e05fdb64c9f7da01af096a73cd11bb7ab755", - "version" : "4.86.2" + "revision" : "4942d74e8493fc918ed6144c835c8a0e6affd4f4", + "version" : "4.92.1" } }, { diff --git a/Package.swift b/Package.swift index 2ec4cb7..6c6abea 100644 --- a/Package.swift +++ b/Package.swift @@ -35,7 +35,7 @@ swiftSettings = [] let package = Package(name: "Firewalk", platforms: [.macOS(.v10_15)], products: [.executable(name: "firewalk", targets: ["firewalk"])], - dependencies: [.package(url: "https://github.com/vapor/vapor.git", from: "4.86.0")], + dependencies: [.package(url: "https://github.com/vapor/vapor.git", from: "4.92.0")], targets: [.executableTarget(name: "firewalk", dependencies: [.product(name: "Vapor", package: "vapor")], path: "Sources", diff --git a/Sources/Methods.swift b/Sources/Methods.swift index e8c0aa7..3385f52 100644 --- a/Sources/Methods.swift +++ b/Sources/Methods.swift @@ -44,9 +44,15 @@ func createMethodRoutes(for app: Application) throws { case Int.min..<200: return Response(status: .badRequest) case 200..<300: - let reply = try Reply(to: request) - let encodedReply = try JSONEncoder().encodeAsByteBuffer(reply, allocator: app.allocator) - return Response(status: .init(statusCode: code), body: .init(buffer: encodedReply)) + if code == 204 || code == 205 { + let response = Response(status: .init(statusCode: code)) + response.headers.contentType = nil + return response + } else { + let reply = try Reply(to: request) + let encodedReply = try JSONEncoder().encodeAsByteBuffer(reply, allocator: app.allocator) + return Response(status: .init(statusCode: code), body: .init(buffer: encodedReply)) + } case 300..<400: let response = Response(status: .init(statusCode: code)) let address = app.http.server.configuration.address @@ -59,18 +65,16 @@ func createMethodRoutes(for app: Application) throws { // NIO stops parsing HTTP when an upgrade is detected, so close the connection. // Remove if NIO / Vapor fixes the issue. if request.headers.contains(name: .upgrade) { - response.headers.connection = .close + response.headers.connection = .close } - return response default: let response = Response(status: .badRequest) // NIO stops parsing HTTP when an upgrade is detected, so close the connection. // Remove if NIO / Vapor fixes the issue. if request.headers.contains(name: .upgrade) { - response.headers.connection = .close + response.headers.connection = .close } - return response } }