http-range
http-range copied to clipboard
Space in Range header result in a ParseException
Hey Ramsey,
thanks for the great work. I used your range parser as base for a new PSR Handler & Middleware, that I will publish soon. With my tests, a found an issue in your parser.
Best regards, Tim
Description
I got this ParseException "Unable to parse range: 210-250" if the header is "bytes=0-199, 210-250"
Steps to reproduce
Call your code with a Range header incl. multiple ranges separated by space: bytes=0-199, 210-250
Expected behavior
I would expect the same behavior as with this header bytes=0-199,210-250 (without space). The space is allowed in this context and should be trimmed/skipped in the parsing process.
Same docs:
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range
Environment details
- version of this package: dev-main
- PHP version: 8.2.7
- OS: current macOS
Thanks for the bug report!
I just realized that I've not updated the GitHub Actions workflows to test this library on PHP 8.1 or 8.2 yet, so I'll handle that while taking a look at this issue.