Skip to content

0.23.0 Range Requests

Choose a tag to compare

@swhitty swhitty released this 06 Jun 04:59
· 56 commits to main since this release
523a886

What's Changed

  • Swift 6.1 on github actions by @swhitty in #152
  • [Windows] Call WSAStartup before WinSDK.socket(...) is called by @gregcotten in #153
  • fix(header): add content-disposition header by @PLKHawaR in #154
  • fix(header): include missing essential headers by @PLKHawaR in #155
  • Update FileHTTPHandler to support partial range requests by @swhitty in #157
  • Handle offset requests by @swhitty in #158

New Contributors

Full Changelog: 0.22.0...0.23.0

Ranged Requests

FileHTTPHandler now supports range requests, responding with HTTP 206 Partial Content allowing for efficient streaming of media content:

await server.appendRoute("GET,HEAD /jaws", to: .file(named: "jaws.m4v"))

When clients request the route and provide a range header

GET /jaws HTTP/1.1
Host: localhost
Range: bytes=41000-49999

The response return just the requests bytes;

HTTP/1.1 206 Partial Content
Content-Type: video/mp4
Content-Range: bytes 41000-49999/60000
Content-Length: 9000
Accept-Ranges: bytes