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.
- Port Listening
- FastCGI Server support
- HTTP Server support (request and response)
Kitura-net package to the dependencies within your application’s
Package.swift file. Substitute
"x.x.x" with the latest
.package(url: "https://github.com/IBM-Swift/Kitura-net.git", from: "x.x.x")
KituraNet to your target's dependencies:
.target(name: "example", dependencies: ["KituraNet"]),
Contributing to Kitura-net
All improvements to Kitura-net are very welcome! Here's how to get started with developing Kitura-net itself.
- Clone this repository.
$ git clone https://github.com/IBM-Swift/Kitura-net && cd Kitura-net
- Build and run tests.
$ swift test
You can find more info on contributing to Kitura in our contributing guidelines.
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.
You may find interesting
- fix: Send Basic Auth credentials in an Authorization header (#303)
- feat: Ability to limit request size and connection count (#307)
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.
- feat: Add support for Unix domain sockets (#296)
- Disable curl's
Expectheader (#294): prevents ClientRequest (which uses curl) from sending an
Expect: 100-continueheader when sending payloads above a certain threshold, as Kitura does not support it (resulting in a 1 second delay for such requests).
- fix: resolve crash on Linux with Swift 5 (#284)
- fix: workaround to pass UInt16 value for ClientRequest.Options (#285) - resolves #275
- fix: Ensure exclusive access (SE-0176) when mutating
- Resolves compilation warnings with Swift 4.2 (#277)
- Fixes for ClientRequest redirection behaviour (#270)
- http_parser upgrade (#272)
- Documentation improvements
classproperty 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)
- Support Swift 4.1 (#242)
- Increase number of GCD read queues (#235)
Migrated repo to Swift 4.0.2.
- Close Keep-Alive connections following a parser error (#232)
- Support HTTP Pipelining (#229)
- Fix parsing of responses to
HEADrequests with non-zero
- Prevent collision on
HTTPParserstate by consecutive keepalive requests (#227)
- Disable port reuse by default (#223)
- Allow PATCH requests to send data (#224)
- Resolves issue IBM-Swift/Kitura#1143 (#219), where a misbehaved client connecting to an SSL listener could block further connection attempts from other clients.
- 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.
Fix crash in
IncomingSocketHandler as reported in Kitura/#1034
Tested on Swift 4 6/29 snapshot