Skip to content

Add range request support#33

Open
samdark wants to merge 6 commits into
masterfrom
issue-2-range-requests
Open

Add range request support#33
samdark wants to merge 6 commits into
masterfrom
issue-2-range-requests

Conversation

@samdark

@samdark samdark commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

  • add optional request-aware byte range handling for download responses
  • add bounded byte range stream for seekable response bodies
  • document range request behavior

@samdark samdark marked this pull request as ready for review June 10, 2026 21:26
Copilot AI review requested due to automatic review settings June 10, 2026 21:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds optional HTTP Range request handling to download responses so clients can request partial content when the response body is seekable and its size is known.

Changes:

  • Add an optional PSR-7 server request parameter to sendStreamAsFile(), sendFile(), and sendContentAsFile() to enable byte-range handling.
  • Introduce ByteRangeStream to expose a bounded, seekable view over an underlying stream for 206 responses.
  • Add PHPUnit coverage for range behaviors (206 / suffix ranges / 416) and document the feature + changelog entry.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/DownloadResponseFactory.php Adds request-aware range parsing and response shaping (206/416) with appropriate headers.
src/ByteRangeStream.php New stream wrapper to read/seek within a specified byte range.
tests/DownloadResponseFactoryTest.php Adds tests for single-range, open-ended, suffix, unsupported multi-range, and unsatisfiable range cases.
README.md Documents how to enable range request support and outlines behavior/limitations.
CHANGELOG.md Adds an entry announcing range request support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/DownloadResponseFactory.php Outdated
Comment thread src/DownloadResponseFactory.php
Comment thread src/ByteRangeStream.php
Comment thread src/ByteRangeStream.php

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Comment thread src/DownloadResponseFactory.php
Comment thread README.md Outdated
Comment thread src/ByteRangeStream.php Outdated
Comment thread src/ByteRangeStream.php Outdated
Comment thread src/ByteRangeStream.php Outdated
Comment thread src/ByteRangeStream.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/DownloadResponseFactory.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comment thread src/ByteRangeStream.php Outdated
Comment thread src/ByteRangeStream.php Outdated
Comment thread src/ByteRangeStream.php Outdated
Comment thread src/DownloadResponseFactory.php Outdated
Comment thread src/DownloadResponseFactory.php Outdated
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.

3 participants