Skip to content

Send the parent page as Referer on a partial reget - #2099

Open
xroche wants to merge 2 commits into
masterfrom
fz/B10
Open

xroche wants to merge 2 commits into
masterfrom
fz/B10

Conversation

@xroche

@xroche xroche commented Nov 7, 2026

Copy link
Copy Markdown
Owner

A resumed download that gets a 412 or 416 is fetched again from the start. That new request now sends the page that linked to the file as its Referer, as the first request did. Before, it named the file itself, which a server that blocks hotlinks can refuse. The other two places that queue a file again already copy the parent this way.

Test 20 now logs each request to the file and checks the Referer of the full fetch. It fails on master, where the header is .../resume/blob.txt, and passes with the fix.

When a resume Range gets a 412 or 416, the partial is dropped and the
file is queued again without a Range. That copy set its precedent to the
file's own heap slot, so the re-get sent the file itself as Referer. The
other two re-record sites already copy heap(ptr)->precedent.

Test 20 now logs Range and Referer per request and checks the re-get
carries the parent page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche enabled auto-merge (squash) November 7, 2026 18:30
@xroche
xroche disabled auto-merge November 7, 2026 19:46
Windows Python wrote CRLF, so the Referer match in test 20 failed under WSL2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche enabled auto-merge (squash) November 7, 2026 19:47
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