Skip to content

Save a modern file type under its own extension - #2100

Merged
xroche merged 3 commits into
masterfrom
fz/B21
Nov 7, 2026
Merged

xroche merged 3 commits into
masterfrom
fz/B21

Conversation

@xroche

@xroche xroche commented Nov 7, 2026

Copy link
Copy Markdown
Owner

is_knowntype() now also reads the modern MIME table. So photo.webp served as image/jpeg is saved as photo.jpg, not photo.webp.jpg, and the 26 modern extensions count as known non-HTML types, like .png.

This changes more than save names. In -%N0 and -%N1 these files get no HEAD probe. -p1 now skips them, and -n now takes them from other hosts. An --update of an old mirror can rename a file such as photo.webp.jpg to photo.jpg.

Test 764 checks the save name in the three delayed modes and the -p and -n verdicts. It fails on a build without the fix, and the .png and .foo controls do not change.

tools/parser-diff.sh passes --self-check and finds no difference against origin/master on any leg.

xroche and others added 3 commits November 7, 2026 18:53
is_knowntype() scanned only hts_mime[], so the 26 extensions of
hts_mime_modern[] (webp, woff2, mp4, json...) were unknown: photo.webp
served as image/jpeg was saved as photo.webp.jpg, and ishtml() said -1
for them. A hts_mime_find() helper now scans both tables, and
get_httptype_sized() and give_mimext() use it too.

The ishtml() verdict for these extensions moves from -1 to 0, like .png:
-%N0 and -%N1 no longer probe them, -p1 skips them and -n takes them.
Test 764 pins the save name in each delayed mode and the -p and -n
verdicts, through a new wizardnonhtml self-test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
-%N0 sends a HEAD request to learn an unknown extension's type, so the
/photo.foo row reached www.example.com and could stall for two minutes
on a network that drops packets. Pass nosback=1, as test 353 does.

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:04
@xroche
xroche merged commit 6b167df into master Nov 7, 2026
39 checks passed
@xroche
xroche deleted the fz/B21 branch November 7, 2026 21:51
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