Skip to content

Releases: swhitty/FlyingFox

Initial Support for Swift 5.9 & DiscardingTaskGroup

29 Jun 06:10
8b195ab
Compare
Choose a tag to compare
  • Adds support for Swift 5.9 and DiscardingTaskGroup (when available). #60
  • Xcode 15 Beta 2 support
  • Support image/x-icon, image/webp, image/jp2 Content-Type.

Initial Support for Swift 5.9 & DiscardingTaskGroup

16 Jun 03:39
1169214
Compare
Choose a tag to compare
  • Adds support for Swift 5.9 and DiscardingTaskGroup (when available). #60
  • isListening public API #59
  • Support image/svg+xml Content-Type.

Large Requests with HTTPBodySequence

03 Apr 01:35
7488f1e
Compare
Choose a tag to compare

Adds support for very large bodies within HTTPRequest and HTTPResponse that can be processed in Data chunks.

HTTPRequest

Requests now include a bodySequence: HTTPBodySequence which allows the request body to be iterated in small chunks as they arrive:

func saveBody(request: HTTPRequest) async throws -> HTTPResponse {
  let file = URL(fileURLWithPath: "/tmp/file")
  _ = FileManager.default.createFile(atPath: file.path, contents: nil)
  let handle = try FileHandle(forWritingTo: file)
  for try await chunk in req.bodySequence {
    try handle.write(contentsOf: chunk)
  }
  return HTTPResponse(statusCode: .ok)
}

The existing var data: Data property has been deprecated, but is still supported and synchronously returns the uploaded data for requests less than 10 MiB.

HTTPResponse

Response payloads can provide a HTTPBodySequence which allows the response body to be provided in small chunks as they are sent:

func getXcode(request: HTTPRequest) async throws -> HTTPResponse {
  try HTTPResponse(
    statusCode: .ok,
    body: HTTPBodySequence(file: URL(fileURLWithPath: "/tmp/Xcode_14.3.xip"))
  )
}

Providing a Data instance for the body property is still supported.

The existing var data: Data? property has been deprecated, but is still supported and synchronously returns response payload if the response is not a web socket or HTTPBodySequence.

FileHTTPHandler

The existing FileHTTPHandler now serves all files larger than 10 MiB in small chunks, while files smaller are still served via a complete Data instance.

Large Requests with HTTPBodySequence

03 Apr 00:22
96d7101
Compare
Choose a tag to compare

Adds support for very large bodies within HTTPRequest and HTTPResponse that can be processed in Data chunks.

HTTPRequest

Requests now include a bodySequence: HTTPBodySequence which allows the request body to be iterated in small chunks as the arrive:

func saveBody(request: HTTPRequest) async throws -> HTTPResponse {
  let file = URL(fileURLWithPath: "/tmp/file")
  _ = FileManager.default.createFile(atPath: file.path, contents: nil)
  let handle = try FileHandle(forWritingTo: file)
  for try await chunk in req.bodySequence {
    try handle.write(contentsOf: chunk)
  }
  return HTTPResponse(statusCode: .ok)
}

The existing var data: Data property has been deprecated, but is still supported and synchronously returns the uploaded data for requests less than 10 MiB.

HTTPResponse

Response payloads can provide a HTTPBodySequence which allows the response body to be provided in small chunks as they are sent:

func getXcode(request: HTTPRequest) async throws -> HTTPResponse {
  try HTTPResponse(
    statusCode: .ok,
    body: HTTPBodySequence(file: URL(fileURLWithPath: "/tmp/Xcode_14.3.xip"))
  )
}

Providing a Data instance for the body property is still supported.

The existing var data: Data? property has been deprecated, but is still supported and synchronously returns response payload if the response is not a web socket or HTTPBodySequence.

FileHTTPHandler

The existing FileHTTPHandler now serves all files larger than 10 MiB in small chunks, while files smaller are still served via a complete Data instance.

SocketPool kqueue / epoll

18 Oct 07:13
8ef9edd
Compare
Choose a tag to compare
  • kqueue(2) / epoll(7) events are now used to suspend and resume socket using SocketPool<EventQueue>
  • SocketPool<EventQueue> is now the default pool used by HTTPServer
  • PollingSocketPool has been replaced by SocketPool<Poll>
  • Windows uses SocketPool<Poll>
  • Moved HTTPLogging to FlyingSocks.Logging enabling logs within sockets and pools.
  • Decreased compilation time

epoll Fix

30 Sep 23:25
ee01188
Compare
Choose a tag to compare

Small bug fix for issue within the epoll event queue which can be used on Linux platforms.

Support for kqueue / epoll

19 Sep 10:57
03412e3
Compare
Choose a tag to compare
  • Gracefully finish existing requests then stop server with await server.stop()
  • Retrieve the server listening address with await server.listeningAddress
  • Use makeEventQueuePool() to enable kqueue(2) on Darwin platforms and epoll(7) on Linux.
  • PollingSocketPool remains the default socket pool.
  • Fixes WebSocket bug where connection would not be removed after disconnection.
  • Fixes for Swift 5.7 related warnings

Swift 5.7 Support

29 Aug 04:50
7cdc982
Compare
Choose a tag to compare

0.7.0

04 Jun 05:08
4eb0054
Compare
Choose a tag to compare
  • import FlyingSocks module exposes the underlying async sockets that power FlyingFox
  • HTTPServer can be started with any AsyncSocketPool.
  • PollingSocketPool can be tuned to control the interval before and after each loop.
  • Improved concurrency checking support on Swift 5.6
  • Experimental support for Windows 10

0.6.0

28 Mar 00:27
45e3cca
Compare
Choose a tag to compare
  • WebSocketHTTPHandler enables support for WebSockets allowing handlers to exchange pair of AsyncStream.
  • DirectoryHTTPHandler to automatically share all files within a directory.
  • Groups sockaddr structures with protocol SocketAddress
  • Supports UNIX-domain sockets via sockaddr_un