Commit bc409ff
Add HTTP Range header support for partial static file serving (#62)
* Initial plan
* Implement HTTP Range support for static files
- Add Range header parsing for static files
- Support three range types: start-end, start-, and -suffix
- Return 206 Partial Content with Content-Range header
- Return 416 Range Not Satisfiable for invalid ranges
- Add Accept-Ranges: bytes header to all static responses
- Only process ranges for uncompressed files (COMPRESS_METHOD_NONE)
- HEAD requests bypass Range logic as expected
- Fully backward compatible with non-Range requests
Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
* Address code review feedback for Range support
- Add comment clarifying only single ranges are supported (not multipart)
- Remove redundant range_start < 0 validation check
- Add error handling for file streams to prevent crashes
- Multi-range requests now gracefully fall back to full file (200 OK)
Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
* Refactor: eliminate code duplication in stream creation
Use conditional object for createReadStream options instead of
separate if/else branches. Pass {start, end} when is_range_request
is true, otherwise pass empty object.
Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
* version bump
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
Co-authored-by: Len <dev@l3p3.de>1 parent 14e6ec1 commit bc409ff
2 files changed
+81
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1532 | 1532 | | |
1533 | 1533 | | |
1534 | 1534 | | |
1535 | | - | |
1536 | | - | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
1537 | 1592 | | |
1538 | | - | |
1539 | | - | |
1540 | | - | |
1541 | | - | |
1542 | | - | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
1543 | 1605 | | |
1544 | 1606 | | |
1545 | 1607 | | |
1546 | 1608 | | |
1547 | 1609 | | |
1548 | 1610 | | |
1549 | | - | |
1550 | | - | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
1551 | 1622 | | |
1552 | 1623 | | |
1553 | 1624 | | |
| |||
0 commit comments