CGIResponder

0.14.0

I want to write CGI programs in Swift...
YOCKOW/SwiftCGIResponder

What's New

Release v0.14.0.

2026-07-09T08:03:24Z

What's Changed

  • Update the dependencies files. (2026-07-09 06:15:24+0000) by @github-actions[bot] in #96
  • Update dependencies. by @YOCKOW in #97

Full Changelog: 0.13.1...0.14.0

What is SwiftCGIResponder?

SwiftCGIResponder will provide miscellaneous functions you may use when you write CGI programs in Swift.
It's an experimental library under development, and useless as of now.

Requirements

  • Swift >=6.2
    • CoreFoundation
    • Foundation
  • macOS >= 13 or Linux
  • HTTP server software (e.g. Apache or similar software)

Dependencies

---
title: CGIResponder Dependencies
---
flowchart TD
  swiftbootstring(["Bootstring<br>@1.2.0"])
  swiftcgiresponder["CGIResponder"]
  swiftnetworkgear(["NetworkGear<br>@0.21.0"])
  swiftpublicsuffix(["PublicSuffix<br>@2.4.28"])
  swiftranges(["Ranges<br>@4.0.2"])
  swiftstringcomposition(["StringComposition<br>@3.0.0"])
  swifttemporaryfile(["TemporaryFile<br>@5.0.0"])
  swifttimespecification(["TimeSpecification<br>@3.4.0"])
  swiftunicodesupplement(["UnicodeSupplement<br>@2.0.1"])
  swiftxhtml(["XHTML<br>@3.0.0"])
  yswiftextensions(["yExtensions<br>@2.2.1"])

  click swiftbootstring href "https://github.com/YOCKOW/SwiftBootstring.git"
  click swiftnetworkgear href "https://github.com/YOCKOW/SwiftNetworkGear.git"
  click swiftpublicsuffix href "https://github.com/YOCKOW/SwiftPublicSuffix.git"
  click swiftranges href "https://github.com/YOCKOW/SwiftRanges.git"
  click swiftstringcomposition href "https://github.com/YOCKOW/SwiftStringComposition.git"
  click swifttemporaryfile href "https://github.com/YOCKOW/SwiftTemporaryFile.git"
  click swifttimespecification href "https://github.com/YOCKOW/SwiftTimeSpecification.git"
  click swiftunicodesupplement href "https://github.com/YOCKOW/SwiftUnicodeSupplement.git"
  click swiftxhtml href "https://github.com/YOCKOW/SwiftXHTML.git"
  click yswiftextensions href "https://github.com/YOCKOW/ySwiftExtensions.git"

  swiftcgiresponder --> swiftnetworkgear
  swiftcgiresponder --> swifttemporaryfile
  swiftcgiresponder ----> swifttimespecification
  swiftcgiresponder --> swiftxhtml
  swiftcgiresponder --> yswiftextensions
  swiftnetworkgear ----> swiftbootstring
  swiftnetworkgear ----> swiftpublicsuffix
  swiftnetworkgear ----> swiftranges
  swiftnetworkgear --> swifttemporaryfile
  swiftnetworkgear --> swiftunicodesupplement
  swiftnetworkgear --> yswiftextensions
  swiftstringcomposition --> yswiftextensions
  swifttemporaryfile ----> swiftranges
  swifttemporaryfile --> yswiftextensions
  swiftunicodesupplement ----> swiftranges
  swiftxhtml --> swiftnetworkgear
  swiftxhtml ----> swiftranges
  swiftxhtml --> swiftstringcomposition
  swiftxhtml --> swiftunicodesupplement
  swiftxhtml --> yswiftextensions
  yswiftextensions ----> swiftranges
  yswiftextensions --> swiftunicodesupplement


Loading

Usage

import CGIResponder
import NetworkGear

var responder = CGIResponder()
responder.status = .ok
responder.contentType = ContentType(pathExtension: .txt, parameters: [.charset: "UTF-8"])!
responder.content = .string("Hello, World!\n", encoding: .utf8)
try! responder.respond()

// -- Output --
// Status: 200 OK
// Content-Type: text/plain; charset=UTF-8
//
// Hello, World!
//

You may see other samples in Samples Directory.

How to install

You can use Swift Package Manager easily to import CGIResponder to your project.

Example of Package.swift

// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
  name: "MyCGI",
  products: [
    // Products define the executables and libraries produced by a package, and make them visible to other packages.
    .executable(name: "cgi1", targets: ["CGI1"]),
    .executable(name: "cgi2", targets: ["CGI2"]),
    .library(name: "CGIManager", type:.dynamic, targets: ["CGIManager"]),
  ],
  dependencies: [
    // Dependencies declare other packages that this package depends on.
    .package(url:"https://github.com/YOCKOW/SwiftNetworkGear.git", .branch("master")),
    .package(url:"https://github.com/YOCKOW/SwiftCGIResponder.git", .branch("master")),
  ],
  targets: [
    // Targets are the basic building blocks of a package. A target can define a module or a test suite.
    // Targets can depend on other targets in this package, and on products in packages which this package depends on.
    .target(name: "CGI1", dependencies:["SwiftCGIResponder", "SwiftNetworkGear"]),
    .target(name: "CGI2", dependencies:["SwiftCGIResponder", "SwiftNetworkGear"]),
    .target(name: "CGIManager", dependencies:["SwiftCGIResponder"]),
    .testTarget(name: "CGIManagerTests", dependencies: ["CGIManager"]),
  ]
)

License

MIT License.
See "LICENSE.txt" for more information.

Description

  • Swift Tools 6.2.0
View More Packages from this Author

Dependencies

Last updated: Fri Jul 31 2026 22:35:19 GMT-0900 (Hawaii-Aleutian Daylight Time)