Repository navigation
Commit 1b21f5a
Read GET request bodies in the HTTP/1.1 loopback helper (#134419)
## Fix
The Content rows in `SendAsync_RequestWithLatin1HeaderValue_Succeeds`
send a GET with `StringContent("test content")`, but the HTTP/1.1
loopback helper skipped GET bodies. It could therefore send its response
and close while the client still had request bytes to send.
Local packet captures using the archived build 1606484 binaries
reproduced the matching Windows 10053 failure: headers plus `test cont`,
then the server's complete 200 response and FIN, then the client's final
`ent`, followed by a server reset. Nine of the twelve body bytes were
already in the helper buffer in a failure snapshot; unread kernel bytes
alone are not the explanation. The unsafe interleaving is teardown
before the client's remaining upload arrives.
Following review, remove the test-local server branch and fix
`LoopbackServer.Connection.ReadRequestDataAsync` instead: honor
Content-Length and chunked framing for GET just as for other request
methods. The Latin1 test returns to its existing server path, which now
reads the body before responding and closing. Its request method,
raw-header assertions, response headers, non-ASCII early returns, and
special WinHTTP HTTP/2 path are unchanged. Header-only callers can still
use `readBody: false` and read the body separately.
Add a four-row HTTP/1.1 regression theory covering
Content-Length/chunked framing and immediate/deferred body reads. No
product changes, retries, sleeps, timeout increases, or additional
Latin1 server cases.
## Validation of current shared-helper fix
Windows x64, Debug libraries with Release CoreCLR, plus .NET Framework
4.8.1 where listed. All final builds succeeded with zero warnings and
zero errors.
- New GET-body regression: all 4 rows failed before the helper change
(expected `test content`, actual empty body); all 4 pass afterward.
- Focused Sockets run: 76 passed (72 existing Latin1 rows plus 4 new
regression rows), zero failures/skips. Nine of each class's eighteen
Latin1 rows still return early for values above 0x7f.
- Full System.Net.Http functional project: 5432 passed, 48 skips, zero
failures.
- Full System.Net.Http unit project: 2677 passed, 4 skips, zero
failures.
- WinHTTP Latin1 theory: 36 passed on current .NET and 18 passed on .NET
Framework 4.8.1, zero failures/skips.
- Full WinHTTP functional project: current .NET 1708 passed / 41 skips;
.NET Framework 4.8.1 639 passed / 28 skips; zero failures.
- Full WinHTTP unit project: 173 passed, zero failures/skips.
- Full System.Net.Http.Json functional project: current .NET 90 passed
and .NET Framework 4.8.1 77 passed, zero failures/skips.
- Full System.Net.Requests project: 1207 passed, 8 skips, zero failures.
These runs exercise existing skip conditions; this revision adds no
skips to existing tests. Other operating systems and browser/WASI
execution were not run locally.
## Earlier test-local candidate evidence
The following measurements were taken for the superseded test-local fix
at `2451ea85565a98e374e7444f5054d6df75e458dc`, not repeated for the
current shared-helper implementation:
| Check | Original | Earlier candidate |
|---|---:|---:|
| Full Latin1 theory, all four Sockets classes | 2 failures / 72 | 0
failures / 72 |
| SOH/BEL/DEL Content, fresh interleaved processes | 1 x 10053 / 3600 |
0 failures / 3600 |
| Ordinary ASCII Content | 400 passed | 400 passed |
The original theory failures were DEL/Content in both Sockets and the
inherited Sync class. This method calls `SendAsync` directly in both
classes. The repeated Content/ASCII calls do not return early. All fresh
repetition completed, with no 10054 errors or timeouts.
The earlier candidate also passed the full System.Net.Http functional
project (5428 passed, 48 skips), unit project (2677 passed, 4 skips),
WinHTTP Latin1 controls (36 current .NET and 18 .NET Framework), and 40
extracted-source branch probes covering split-body completion,
truncated-body EOF, incorrect Content-Length, and incorrect body,
including connection closure on failures.
These are local reproductions, not packet captures from the historical
CI machine. Sixteen unlocalized timeouts from an earlier diagnostic run
remain retained and unexplained; they are not counted as passes or
claimed fixed by either implementation.
Resolves #132004
> [!NOTE]
> This change and description were prepared with GitHub Copilot.
---------
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>1 parent 8e3a74e commit 1b21f5a
2 files changed
Lines changed: 37 additions & 9 deletions
File tree
- src/libraries
- Common/tests/System/Net/Http
- System.Net.Http/tests/FunctionalTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
815 | 815 | | |
816 | 816 | | |
817 | 817 | | |
818 | | - | |
| 818 | + | |
819 | 819 | | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
828 | 825 | | |
829 | 826 | | |
830 | 827 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
19 | 50 | | |
20 | 51 | | |
21 | 52 | | |
| |||
0 commit comments