Skip to content

Conversation

swhitty
Copy link
Owner

@swhitty swhitty commented Jun 4, 2025

Updates FileHTTPHandler to support partial range requests.

Routes for both GET and HEAD must be created to a file:

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

@swhitty swhitty linked an issue Jun 4, 2025 that may be closed by this pull request
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

Attention: Patch coverage is 98.91304% with 1 line in your changes missing coverage. Please review.

Project coverage is 94.76%. Comparing base (e4e48d7) to head (14ba490).

Files with missing lines Patch % Lines
...lyingSocks/Sources/AsyncBufferedFileSequence.swift 97.05% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #157      +/-   ##
==========================================
+ Coverage   94.59%   94.76%   +0.16%     
==========================================
  Files          62       62              
  Lines        4032     4105      +73     
==========================================
+ Hits         3814     3890      +76     
+ Misses        218      215       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@swhitty swhitty mentioned this pull request Jun 4, 2025
@swhitty swhitty merged commit 4f34966 into main Jun 4, 2025
44 of 46 checks passed
@swhitty swhitty deleted the filehandler-partial-range-requests branch June 4, 2025 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Support HTTP range requests
1 participant