Skip to content

fix(request): accept single-byte ranges in parseRange - #262

Closed
shimonewman wants to merge 1 commit into
mainfrom
fix-parse-range-method
Closed

fix(request): accept single-byte ranges in parseRange#262
shimonewman wants to merge 1 commit into
mainfrom
fix-parse-range-method

Conversation

@shimonewman

Copy link
Copy Markdown
Contributor

RFC 9110 byte-range bounds are inclusive, so bytes=0-0 (a one-byte range, commonly sent by Safari/iOS players probing range support) and a request for a file's final byte are valid. parseRange() rejected any range where start >= end, so these requests parsed as no-range and consumers answered 416. Only start > end is invalid.

RFC 9110 byte-range bounds are inclusive, so `bytes=0-0` (a one-byte
range, commonly sent by Safari/iOS players probing range support) and a
request for a file's final byte are valid. parseRange() rejected any
range where start >= end, so these requests parsed as no-range and
consumers answered 416. Only start > end is invalid.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Thanks for contributing! This repository is a read-only mirror; development for this library happens in packages/http in the utopia-php monorepo. Please open this pull request there instead.

@github-actions github-actions Bot closed this Aug 26, 2026
@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown

Greptile Summary

Corrects Request::parseRange() to accept inclusive single-byte byte ranges where the start and end offsets are equal.

  • Changes the invalid-range check from start >= end to start > end.
  • Adds coverage for the first byte, a later single byte, and a reversed invalid range.

Confidence Score: 5/5

The pull request appears safe to merge with no actionable correctness or security issues identified.

The changed comparison correctly accepts equal inclusive bounds, retains rejection of start-greater-than-end ranges, and is covered by targeted regression tests.

Important Files Changed

Filename Overview
src/Http/Request.php Aligns range validation with inclusive RFC 9110 bounds while continuing to reject reversed intervals.
tests/RequestTest.php Adds focused regression coverage for equal-bound single-byte ranges and preserves coverage for invalid reversed bounds.

Reviews (1): Last reviewed commit: "fix(request): accept single-byte ranges ..." | Re-trigger Greptile

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.

1 participant