Swiftpack.co - Package - Kitura/Kitura-net


The Kitura-net module contains logic for sending and receiving HTTP requests. It also contains the structure for listening on a port and sending requests to a delegate for processing. It can be used to create HTTP/CGI servers on specific ports, and provides HTTP functionality.

We expect most of our users to require higher level concepts such as routing, templates and middleware, these are not provided in Kitura-net, if you want to use those facilities you should be coding at the Kitura level, for this please see the Kitura project. Kitura-net underpins Kitura which offers a higher abstraction level to users.

Kitura-net utilises the BlueSocket framework, the BlueSSLService framework and CCurl.


  • Port Listening
  • FastCGI Server support
  • HTTP Server support (request and response)


Add dependencies

Add the Kitura-net package to the dependencies within your application’s Package.swift file. Substitute "x.x.x" with the latest Kitura-net release.

.package(url: "https://github.com/IBM-Swift/Kitura-net.git", from: "x.x.x")

Add KituraNet to your target's dependencies:

.target(name: "example", dependencies: ["KituraNet"]),

Import package

import KituraNet

Contributing to Kitura-net

All improvements to Kitura-net are very welcome! Here's how to get started with developing Kitura-net itself.

  1. Clone this repository.

$ git clone https://github.com/IBM-Swift/Kitura-net && cd Kitura-net

  1. Build and run tests.

$ swift test

You can find more info on contributing to Kitura in our contributing guidelines.

API Documentation

For more information visit our API reference.


We love to talk server-side Swift, and Kitura. Join our Slack to meet the team!


This library is licensed under Apache 2.0. Full license text is available in LICENSE.


Stars: 98

Used By

Total: 0


2.4.0 -

  • fix: Send Basic Auth credentials in an Authorization header (#303)
  • feat: Ability to limit request size and connection count (#307)

2.3.0 -

feat: Allow Kitura-NIO to only listen on one network address (#299). Kitura listens on every available address/interface. This feature allows Kitura to listen on only on interface/network address.

2.2.0 -

  • feat: Add support for Unix domain sockets (#296)

2.1.7 -

  • Disable curl's Expect header (#294): prevents ClientRequest (which uses curl) from sending an Expect: 100-continue header when sending payloads above a certain threshold, as Kitura does not support it (resulting in a 1 second delay for such requests).

2.1.5 -

  • fix: resolve crash on Linux with Swift 5 (#284)

2.1.4 -

  • fix: workaround to pass UInt16 value for ClientRequest.Options (#285) - resolves #275

2.1.3 -

  • fix: Ensure exclusive access (SE-0176) when mutating ClientRequest.delegate (#278)

2.1.2 -

  • Resolves compilation warnings with Swift 4.2 (#277)

2.1.1 -

  • Fixes for ClientRequest redirection behaviour (#270)
  • http_parser upgrade (#272)
  • Documentation improvements

2.1.0 -

  • Add class property on HTTPStatusCode and Class enum, to enable querying of the class that a status code belongs to (#246, successor to #240)
  • Update dependencies for Swift 4.1 (#250)

2.0.4 -

  • Support Swift 4.1 (#242)

2.0.2 -

  • Increase number of GCD read queues (#235)

v2.0.0 -

Migrated repo to Swift 4.0.2.

1.7.20 -

  • Close Keep-Alive connections following a parser error (#232)
  • Support HTTP Pipelining (#229)

1.7.19 -

  • Fix parsing of responses to HEAD requests with non-zero Content-Length (#225)
  • Prevent collision on HTTPParser state by consecutive keepalive requests (#227)

1.7.18 -

  • Disable port reuse by default (#223)
  • Allow PATCH requests to send data (#224)

1.7.17 -

  • Resolves issue IBM-Swift/Kitura#1143 (#219), where a misbehaved client connecting to an SSL listener could block further connection attempts from other clients.

1.7.16 -

What's New

  • Add support for Swift 4
  • Allow the limit on consecutive Keep-Alive requests per connection to be configurable. The default has been changed to allow an unlimited number of requests.

Temporary workaround for a rare crash under load -


Address Intermittent Crashes -

Insure that the IncomingSocketProcessor used by an IncomingSocketHandler has the back link to the IncomingSocketHandler initialized before the ReaderSource is resumed.

Also removed an unneeded back link to the IncomingSocketManager.

1.7.13 -

Fix crash in IncomingSocketHandler as reported in Kitura/#1034 Tested on Swift 4 6/29 snapshot

1.7.7 -

v0.18.0 -



v0.10.0 -

v0.8.0 -

v0.6.0 -

v0.4.1 -

v0.4.0 -