Skip to content

httpclient: an HTTP/1.0 response with Transfer-Encoding is refused as faulty framing, and its connection closed, rather than read as chunked (#541) - #565

Merged
MDA2AV merged 2 commits into
mainfrom
fix-541
Nov 14, 2026
Merged

MDA2AV merged 2 commits into
mainfrom
fix-541

Conversation

@MDA2AV

@MDA2AV MDA2AV commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Fixes #541.

RFC 9112 §6.1: "A server or client that receives an HTTP/1.0 message containing a Transfer-Encoding header field MUST treat the message as if the framing is faulty, even if a Content-Length is present, and close the connection after processing the message."

The client takes its framing from Glyph11, which had no such rule, so HTTP/1.0 200 OK with Transfer-Encoding: chunked and a chunked hello came back as 200|hello. Glyph11 0.4.1 refuses the message in both of its hardened parsers (dotnet-web-stack/Glyph11#91). The client turns a refused head into a failed request on a connection it discards, as it does any malformed head, so the connection is never reused.

Glyph11 0.3.7 to 0.4.1. TryExtractFullResponseHeaderROM is obsolete since 0.4.0. The client calls TryParseResponseHeader, which reports the header block's true length, so the + 1 goes. Glyph11's other response fixes since 0.3.7 come along, and they are the behaviour changes to know:

The rule is on the field. A 304 or a HEAD response with Transfer-Encoding is refused too, though it has no body to misread: the RFC names the field, and Glyph11 checks it.

Tests. HttpClientHttp10Tests: the issue's test, a 304, and a keep-alive response whose connection must not be reused, beside an HTTP/1.0 response with Content-Length, which is read. On Glyph11 0.4.0 the three refusals fail; on 0.4.1 they pass.

Suites. Http 99/0 and Unit 211/0, the two suites that reference ioxide.httpclient.

@MDA2AV MDA2AV changed the title httpclient: an HTTP/1.0 response with Transfer-Encoding is refused as faulty framing, and its connection closed, rather than read as chunked httpclient: an HTTP/1.0 response with Transfer-Encoding is refused as faulty framing, and its connection closed, rather than read as chunked (#541) Nov 13, 2026
… faulty framing, and its connection closed, rather than read as chunked

RFC 9112 6.1: a client that receives an HTTP/1.0 message with a
Transfer-Encoding MUST treat its framing as faulty and close the
connection after it. The client takes its framing from Glyph11, which had
no such rule. Glyph11 0.4.1 refuses the message in its hardened parsers
(dotnet-web-stack/Glyph11#91), and the client turns that into a failed
request on a discarded connection, as it does any malformed head.

The client moves from Glyph11 0.3.7 to 0.4.1, onto TryParseResponseHeader:
TryExtractFullResponseHeaderROM is obsolete since 0.4.0, and the new entry
point reports the header block's true length, so the + 1 goes. Glyph11's
other response fixes since 0.3.7 come with it, among them a bare-LF head
refused at once rather than waited on (Glyph11#85), status codes above 599
refused (Glyph11#80), and Content-Length lists and oversized values framed
by their length (Glyph11#74, Glyph11#75, Glyph11#77).

HttpClientHttp10Tests: the issue's test, a 304, and a keep-alive response
whose connection must not be reused, beside the Content-Length control.
On Glyph11 0.4.0 the three refusals fail; on 0.4.1 they pass.
# Conflicts:
#	tests/Ioxide.Tests.Http/Program.cs
@MDA2AV
MDA2AV merged commit cca7f6f into main Nov 14, 2026
2 checks passed
@MDA2AV
MDA2AV deleted the fix-541 branch November 14, 2026 12:07
@MDA2AV MDA2AV mentioned this pull request Nov 15, 2026
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.

httpclient h1: an HTTP/1.0 response with Transfer-Encoding is read as chunked

1 participant