Skip to content

http: abide to close-rules for chunked when transfer-encoding off - #22950

Closed
bagder wants to merge 2 commits into
masterfrom
bagder/transfer-encoding
Closed

bagder wants to merge 2 commits into
masterfrom
bagder/transfer-encoding

Conversation

@bagder

@bagder bagder commented Sep 14, 2026

Copy link
Copy Markdown
Member

There is no other way to know when the transfer ends. Tweak test 319 to verify this (by setting a wrong Content-Length).

@bagder
bagder marked this pull request as ready for review September 14, 2026 13:54
@github-actions github-actions Bot added the tests label Sep 14, 2026
@bagder
bagder force-pushed the bagder/transfer-encoding branch from e73aebe to 8fa85c0 Compare September 14, 2026 14:24
@bagder
bagder requested a balanced review from Copilot September 14, 2026 14:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Content-Length handling remains order-dependent when it precedes Transfer-Encoding.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Ensures raw, non-chunked Transfer-Encoding responses use connection closure rather than Content-Length for framing.

Changes:

  • Ignores Content-Length after non-chunked Transfer-Encoding.
  • Expands test 319 with an incorrect Content-Length.
File summaries
File Description
lib/http.c Updates response framing and Content-Length handling.
tests/data/test319 Tests close-delimited raw transfer data.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/http.c
@bagder
bagder force-pushed the bagder/transfer-encoding branch 2 times, most recently from 8fa85c0 to 671d590 Compare September 15, 2026 15:38
There is no other way to know when the transfer ends when there is a
transfer encoding set but not chunked - even if transfere-encoding is
disabled. Tweak test 319 to verify this (by setting a wrong
Content-Length).

Add test 2918 to make sure it works the same also when the
Content-Length and Transfer-Encoding headers arrive in the other order
@bagder
bagder force-pushed the bagder/transfer-encoding branch from 671d590 to 170b8f3 Compare September 18, 2026 06:09
@icing

icing commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

test1494 hangs now. It is a response with Content-Length: and Transfer-Encoding: identity. curl waits for the connection to close now, which never happens.

So, fix/scrap that test case?

@bagder

bagder commented Sep 18, 2026

Copy link
Copy Markdown
Member Author

I fixed the test case to correctly close the connection after the response

@bagder bagder closed this in c0609c5 Sep 18, 2026
@bagder
bagder deleted the bagder/transfer-encoding branch September 18, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants