Commit c4ef5fd
authored
fix(http-proxy): preserve m3u redirect semantics (#681)
## Summary
- restrict M3U response body rewriting to successful 2xx responses
- preserve normal HTTP redirect handling for M3U and M3U8 request paths
- add an end-to-end regression test covering a 302 M3U8 response with an
HTML body
## Root cause
M3U detection by URL extension ran for every response status. A 302
response from a path ending in .m3u8 therefore entered the playlist body
rewrite path, which bypassed the existing Location header rewrite and
treated the redirect body as playlist content. Clients could then be
redirected directly to an IPTV-only upstream address that they could not
access.
## Impact
Redirects and error responses from M3U endpoints now retain normal HTTP
semantics. Successful playlist responses continue to be decoded and
rewritten as before.
## Validation
- Release CMake build
- pnpm run lint:clang
- uv run ruff check e2e
- ./scripts/run-e2e.sh -p 1 test_http_proxy_m3u_rewrite.py — 52 passed
- ./scripts/run-e2e.sh -p 1 test_http_proxy.py — 19 passed
- ./scripts/run-e2e.sh -p 1 test_url_template_m3u.py — 19 passed
- uv run pytest e2e --collect-only -q — 540 tests collected
- ./scripts/run-e2e.sh --co — 540 tests collected
- git diff --check1 parent eb82ba9 commit c4ef5fd
2 files changed
Lines changed: 36 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
688 | 688 | | |
689 | 689 | | |
690 | 690 | | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
691 | 721 | | |
692 | 722 | | |
693 | 723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1133 | 1133 | | |
1134 | 1134 | | |
1135 | 1135 | | |
1136 | | - | |
1137 | | - | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
1138 | 1140 | | |
1139 | 1141 | | |
1140 | 1142 | | |
1141 | 1143 | | |
1142 | 1144 | | |
1143 | | - | |
| 1145 | + | |
| 1146 | + | |
1144 | 1147 | | |
1145 | 1148 | | |
1146 | 1149 | | |
| |||
0 commit comments