Skip to content

fix(file-server): do not write media body for HEAD requests - #61

Merged
CypherPotato merged 3 commits into
mainfrom
fix/fileserver-head-media-body
Nov 12, 2026
Merged

CypherPotato merged 3 commits into
mainfrom
fix/fileserver-head-media-body

Conversation

@CypherPotato

Copy link
Copy Markdown
Member

Problem

HttpFileRangedContentStream.Convert (used by the default video/audio file converters) wrote the whole file to the response stream for HEAD requests without a Range header. The ranged branch already skipped the body for HEAD.

  • HttpListener engine: HEAD returned 500 (ProtocolViolationException: bytes exceed Content-Length).
  • Cadente engine: HEAD returned 200 followed by the full body, breaking response framing on persistent/pipelined connections (RFC 9110 §9.3.2).

Fix

Return right after setting status and headers (Accept-Ranges, Content-Type, Content-Length) when the method is HEAD, without reading the file.

Tests

Added FileServerHeadOnMediaFileDoesNotWriteBody (both engines): pipelines HEAD on a 300000-byte .mp4 and a GET, asserting 200, Content-Length: 300000 and that the next response starts right after the HEAD headers. Fails before the fix on both engines.

  • SISK_TEST_ENGINE=Default: 237 passed, 67 skipped, 0 failed
  • SISK_TEST_ENGINE=Cadente: 299 passed, 6 skipped, 0 failed

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T11:35:34.380451Z 6ace0d1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@CypherPotato
CypherPotato merged commit 6b68658 into main Nov 12, 2026
5 checks passed
@CypherPotato
CypherPotato deleted the fix/fileserver-head-media-body branch November 16, 2026 11: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