Skip to content

Fix content range for itag-18#457

Open
t6fb3m59 wants to merge 2 commits into
TeamPiped:mainfrom
t6fb3m59:upstream-pr
Open

Fix content range for itag-18#457
t6fb3m59 wants to merge 2 commits into
TeamPiped:mainfrom
t6fb3m59:upstream-pr

Conversation

@t6fb3m59

@t6fb3m59 t6fb3m59 commented May 30, 2026

Copy link
Copy Markdown

Currently we report the chunk size as the size of the entire file. This changes it to clen with a fallback to content length just in case.

Related: TeamPiped/Piped#4244

The code was written with Claude and reviewed by me.

Summary by CodeRabbit

  • Bug Fixes
    • Improved range response correction with enhanced content-length determination logic and fallback header parsing for more reliable partial content handling.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d43f74a6-f797-4427-acf8-f323f7490e0f

📥 Commits

Reviewing files that changed from the base of the PR and between e8955bb and 17d9f41.

📒 Files selected for processing (1)
  • src/main.rs

📝 Walkthrough

Walkthrough

The handle_range_response_correction function signature is updated to accept an optional clen: Option<u64> parameter. The total_size computation logic now prefers the provided clen value when present and positive, otherwise falls back to parsing content-length from upstream response headers. The call site at line 492 is updated to pass clen as an argument.

Changes

Range Response Correction with Explicit Content Length

Layer / File(s) Summary
Range response correction with explicit content length
src/main.rs
Function signature adds clen: Option<u64> parameter. Logic prioritizes provided clen for total_size computation over header parsing. Call site passes clen argument.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A content-length passed straight and true,
No parsing headers when I have you!
One parameter flows from call to core—
Range responses work better than before! 📦

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix content range for itag-18' clearly and concisely summarizes the main change: correcting how content-range headers are handled for itag-18 responses.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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