Skip to content

Frame empty TLS origin responses in AuTests - #13763

Merged
bneradt merged 1 commit into
apache:masterfrom
bneradt:fix-empty-tls-replay-responses
Oct 3, 2026
Merged

bneradt merged 1 commit into
apache:masterfrom
bneradt:fix-empty-tls-replay-responses

Conversation

@bneradt

@bneradt bneradt commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Preparing ATS CI to move from fedora:44 to fedora:45 exposed TLS AuTest failures with Fedora 45's OpenSSL 4. Several fixture origins send empty responses without a body length and close TLS without close_notify. This patch adds Content-Length: 0 to the empty 200 and expected fallback 404 responses, and updates the remapping gold headers while preserving their status checks.

Validation prerequisites and scope

This fixture patch is one part of the Fedora 45 migration, not a claim that this PR alone makes the complete suite pass. Our OpenSSL 4 validation builds also include #13761, merged as fe7cfc94278d05e0eb772f08a14628a0141437e3. That fix replaces EOF checks on the temporary handshake memory BIO with pending-byte checks. The standalone head of this PR predates it; reproducing the HTTPS tests requires a tree containing that fix as well.

A controlled follow-up used the same OpenSSL 4.0.2 build and the same remap_https fixture tree, with only #13761 removed/restored. Without it, the first HTTPS run stalls after curl's handshake and reaches the diagnostic three-second client deadline. With it, all eight runs pass. The local build still uses Fedora's openssl-libs-4.0.2-2.fc45.aarch64; these follow-up results do not cover 4.0.3.

This PR deliberately frames the empty 200 and explicitly registered fallback 404 responses in the affected tests. It is not an exhaustive cleanup of TLS origins; other unframed registrations remain and need separate auditing. The roughly 47 registrations across 25 files identified in review are not claimed to be safe merely because their clients use HTTPS. In one representative, unchanged tls_verify_base passes all four runs with curl negotiating HTTP/2, but its first empty 200 response hangs when HTTP/1.1 is forced. The client protocol affects whether the incomplete downstream response exposes the tunnel bug; HTTPS alone does not establish the precondition. A passing HTTP/2 client also does not prove that an abruptly closed, unknown-length TLS origin response is valid.

After the review changes, 18 focused AuTests passed on Fedora 45/OpenSSL 4.0.2, covering remap, client certificates, verification/overrides, certificate selection, inactive-client timeout, proxy protocol, and Lua proxy protocol.

The remap tests retain separate responses for their plaintext and TLS origins. Only the TLS response receives Content-Length: 0, preserving the plaintext gold files' assertions about ATS's chunked conversion. The microserver fallback registrations use its default {PATH} lookup, so their / responses apply regardless of the request Host. In the timeout replay files, local headers mappings replaced the anchor's header mapping; the removed anchor Content-Length: 16 was therefore ineffective. The per-response zero lengths are the operative framing change.

Why these fixtures passed before

This is now backed by a controlled comparison, rather than an inference from the Fedora 45 failures.

ATS uses BIO_s_fastopen() for outbound TLS even when TCP Fast Open is disabled. Its fastopen_bread() returns zero when the socket reaches EOF, but does not set BIO_FLAGS_IN_EOF. It delegates BIO_CTRL_EOF to OpenSSL's socket BIO control callback, which checks that flag. See ATS's BIO implementation and outbound BIO setup.

OpenSSL 3.5.7 therefore does not recognize this callback result as BIO EOF. In the isolated probe, an abrupt origin close produces SSL_read() == -1, SSL_ERROR_SYSCALL, an empty error queue, and errno == 0. ATS's _ssl_read_buffer() leaves its application-byte count nread at zero for that failed read, and _ssl_read_from_net() uses the zero count to treat SSL_ERROR_SYSCALL as end-of-stream. For a response without a length, that lets ATS finish the client response.

OpenSSL 4.0.2's legacy-read adapter, bread_conv(), now sets an internal automatic-EOF flag when the callback returns zero without its control callback reporting EOF. BIO_eof() recognizes that flag, so the TLS record layer detects an unexpected EOF and reports SSL_R_UNEXPECTED_EOF_WHILE_READING. This is a concrete difference between the 3.5.7 adapter and the 4.0.2 adapter, together with 4.0.2's BIO EOF handling.

There is a second relevant change: OpenSSL 4's SSL_get_error() uses connection error state instead of the current error queue. If ATS first delivers application bytes as READ_READY and performs another read after clearing the queue, OpenSSL 4 still reports SSL_ERROR_SSL; OpenSSL 3 can fall back to SSL_ERROR_SYSCALL. ATS consequently delivers VC_EVENT_ERROR instead of VC_EVENT_EOS. See the OpenSSL 4 API history.

This is not the first OpenSSL release to consider missing close_notify an error: that policy dates to OpenSSL 3. The custom BIO behavior explains why ATS did not reliably observe it before.

Controlled verification

Built the same ATS checkout twice in the same native ARM Fedora 45 container, with identical GCC 16 and CMake settings. The checkout was based on 2fa4963926a7a7deb2987fcbfa3b5c1e2d400872 with the Fedora 45 compatibility patches, including this PR. The builds differed in the OpenSSL headers/libraries selected: Fedora 44's OpenSSL 3.5.7 versus Fedora 45's OpenSSL 4.0.2. Python 3.15, the OpenSSL 4 origin server, curl 8.21, response bytes, and test settings were held constant. The running processes' /proc/<pid>/maps confirmed the expected ATS and OpenSSL libraries.

A focused diagnostic AuTest exercised 40 exchanges per build: TLS 1.2 and TLS 1.3, with the origin closing immediately or 150 ms after sending its response.

Origin response / shutdown Cases per build ATS + OpenSSL 3.5.7 ATS + OpenSSL 4.0.2
No length, empty or nonempty body, TLS close_notify 8 Completes Completes
Complete Content-Length or complete chunked body, abrupt TLS close 12 Completes Completes
No length, empty or nonempty body, abrupt TLS close 8 Accepted as complete Client reaches its 4-second timeout
Truncated Content-Length, clean or abrupt TLS close 8 Fails promptly Fails promptly
Chunked body missing its terminal chunk, abrupt TLS close 4 Fails promptly Client reaches its 4-second timeout

All 20 valid-completion controls passed with both builds. Repeating both 40-case runs without the SSL tracing interposer produced the same curl outcomes and response bodies (160 ATS exchanges in total). An additional 144 isolated read cases compared OpenSSL 3/4, standard/ATS-style BIOs, clean/abrupt shutdown, and clearing/preserving the error queue, repeated three times under both TLS versions. They reproduced the classification differences above. Explicitly marking EOF in the ATS-style probe also makes OpenSSL 3 detect the initial unexpected EOF, confirming the role of the missing BIO flag.

ATS issue exposed by the investigation

The timeout is an ATS error-handling defect, and this fixture patch does not fix it. Traces show VC_EVENT_ERROR entering HttpSM::tunnel_handler_server(). For an unknown-length response, is_http_server_eos_truncation() returns false; the handler sets read_success = true and finishes the tunnel. However, HttpTunnel::producer_handler_dechunked() does not process VC_EVENT_ERROR to finish chunk generation, leaving the downstream response without its terminal chunk while the client connection remains available for keep-alive. The chunked-origin handler also skips VC_EVENT_ERROR, so it can miss the truncation flag. The client then waits until its own deadline. See the HTTP state-machine handling and the tunnel chunk handlers.

Those core paths need a separate fix and regression coverage for prompt failure and correct client connection handling, tracked in #13784. The diagnostic AuTest's nonzero-curl checks must not be interpreted as proving good error handling: curl exit 28 is a timeout, not a prompt rejection. OpenSSL 3's acceptance of the eight unframed abrupt-close controls is also not proof of protocol correctness.

The fixture changes remain appropriate: these tests exercise remapping, certificates, overrides, proxy protocol, and timeout behavior, and their empty responses should have explicit HTTP framing. RFC 9112 section 9.8 distinguishes a complete framed response from one whose completion depends on a proper TLS close. The controls show that ATS built with OpenSSL 4 handles both complete framed responses and properly closed, unknown-length responses. They do not justify treating an abruptly closed, unknown-length response as complete.

Co-authored-by: GPT-6.1 Sol High

Copilot AI balanced review requested due to automatic review settings September 30, 2026 21:53
@bneradt bneradt added this to the 11.0.0 milestone Sep 30, 2026
@bneradt bneradt self-assigned this Sep 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bryancall bryancall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ Request changes

The analysis in this description is excellent and I verified every source claim in it — the BIO_FLAGS_IN_EOF omission, both HttpTunnel producer handlers, and is_http_server_eos_truncation() all check out exactly as written. The fixture edits are correct, and I confirmed by execution that they are load-bearing on OpenSSL 4.0.2: the tests you fixed go red without this patch and green with it.

What I can't reconcile is the claim that this makes the suite pass on Fedora 45. I built against Fedora 45 GA's own OpenSSL 4.0.2 and most of the TLS tests still fail, including remap_https, which this PR modifies. The cause is a second defect, on the inbound side, and it also explains why the 47 other unframed TLS-origin fixtures were left alone.

Verified by running it: the patch is load-bearing on OpenSSL 4.0.2

Fedora 45 GA ships openssl-libs-4.0.2-2.fc45. Note the stock fedora:45 container image has updates-testing enabled and pulls 4.0.3 instead, so I built and ran both. Everything below is identical on 4.0.2 and 4.0.3.

Built ATS RelWithDebInfo against 4.0.2, then ran the same tests from the base tree and from this PR's tree against that one install:

tree tls_client_cert tls_verify_override
base 2fa4963926 F at run 0 F at run 0
this PR 19/19 pass 13/13 pass

The base failure is exactly the symptom you describe: curl hangs for 120 s on the unframed origin response and exits curl: (18) transfer closed with outstanding read data remaining. So the mechanism is real, the fix works, and I would not have known that from reading alone.

For completeness on the other side: on Fedora 44 / OpenSSL 3.5.8 the patch is behaviour-neutral. Base and patched give byte-identical results, 7 pass and 8 fail, where every one of the 8 is a pre-existing LeakSanitizer failure (ConfigReloadTask::start_progress_checker at ConfigReloadTrace.cc:394, plus an OpenSSL BUF_MEM_new_ex mem-BIO leak) with identical frames before and after. No gold mismatch anywhere. remap_https passing against the new gold confirms the Content-Length: 0 line is positioned correctly.

Blocking: on Fedora 45 the suite still does not pass, and remap_https is one of the failures

Running the seven affected tests against the 4.0.2 build, with this patch applied:

test client scheme result
tls_client_cert http:// 19/19 pass
tls_verify_override http:// 13/13 pass
tls_verify_override_base http:// ×9, https:// ×1 9 pass, F on the one https run
tls_verify_base https:// F at run 0
tls_verify https:// F at run 0
tls_check_cert_selection https:// F at run 0
remap_https https:// F, all 8 runs

Every run that reaches ATS over TLS fails. Every run that reaches it in the clear passes. Zero exceptions, and the split does not care whether this PR touched the file.

The cause is that ATS's inbound TLS handshake never completes on OpenSSL 4. In remap_https's traffic.out (tags lm|ssl):

  • grep -c "handshake EVENT_DONE" is 0. The completion branch at SSLNetVConnection.cc:625 is never reached on any of the 8 connections.
  • Instead, 24 passes through the SSL_HANDSHAKE_WANT_READ branch at SSLNetVConnection.cc:595 — exactly 3 per connection, all within the first millisecond — then nothing.
  • 30.18 s later the handshake timer fires and _readSignalError(ETIMEDOUT) resets the connection.
  • squid.log is never created. The origin microserver logged only AuTest's own /ruok probes. No request ever left ATS.

Client side, curl completes its handshake and sends the request, then sits for 30 s and gets curl: (56) Recv failure: Connection reset by peer. On the runs that negotiate h2 it also reports SSL_write() error: error:00000000:lib(0)::reason(0).

The accept path is _ssl_accept() at SSLNetVConnection.cc:2266: SSL_read_early_data() returns SSL_READ_EARLY_DATA_FINISH with nothing buffered, so it falls through to SSL_accept(), which returns SSL_ERROR_WANT_READ and keeps doing so. update_rbio() then yields read.triggered == 0, the vc leaves the ready list, and nothing ever wakes it — the client has already sent everything, so the socket never becomes readable again. I am not asserting the root cause; the SSL_read_early_data → SSL_accept sequence is the obvious suspect but I did not prove it.

Three controls, because a container is an easy thing to blame:

  • Same container, same curl 8.21.0 linked against the same OpenSSL 4, against openssl s_server: TLS 1.3 handshake and HTTP 200 in 10.8 ms. curl is fine.
  • Same podman invocation, same worktree, same scripts, fedora:44 / OpenSSL 3.5.7 instead: 7/7 pass, remap_https included. The container machinery is fine.
  • Capping inbound at TLS 1.2 (proxy.config.ssl.TLSv1_3.enabled: 0) does not rescue it; the handshake just fails earlier with curl: (35). So it is not a TLS 1.3-only effect.

What I'd like from you here is reconciliation rather than a fix — this is not yours to fix in a test-only PR. You have a Fedora 45 setup where you observed these tests passing, and I have one where they don't. Either your environment differs in a way that matters and is worth naming, or the description's claim needs narrowing to the tests that are actually green. As written, someone will try this on Fedora 45 and conclude the patch didn't work.

One caveat on my side: all my OpenSSL 4 runs were in a rootless podman container, not on a Fedora 45 host. The Fedora 44 control makes the container an unlikely cause, but it does not rule out a container-plus-OpenSSL-4 interaction.

Blocking: why these 21 files and not the other 47 unframed TLS-origin fixtures?

Sweeping tests/gold_tests/**/*.test.py for addResponse calls on a MakeOriginServer(..., ssl=True) origin whose registered response carries neither Content-Length nor Transfer-Encoding, I count 47 surviving registrations across 25 files after this patch. (Regex sweep resolving response dicts by variable, so treat the exact number as approximate; the file list is the point.)

They are not a random 25. Every one of them drives its client over https only — zero http://127 or http://localhost occurrences in any of the 25. Meanwhile every file this PR fixes except remap_https is predominantly http-inbound (12, 13, 11 and 4 occurrences in tls_client_cert, tls_verify_override, tls_verify_override_base, tls_verify_ca_override).

That is exactly the line the inbound defect draws. The most likely reading is that you fixed everything that was observably red, and the other 25 are latent: they never get as far as the origin leg on Fedora 45, so their unframed fixtures never had a chance to fail.

The sharp case is tests/gold_tests/tls/tls_verify_base.test.py, a structural twin of tls_verify_override_base.test.py, which this PR does fix:

  • Same three TLS origins: server_foo, server_bar, and a bare server at line 39 with nothing registered.
  • Same unframed fixture at line 45: "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" with "body": "".
  • Line 61 is a catch-all map / https://127.0.0.1:{server.SSL_Port}, so the "Permissive-Test with logged failure" run at line 116 (host: random.com) reaches an unregistered TLS origin and gets microserver's built-in 404 — which servers.py do_GET sends as Server: + Connection: close with no length framing at all.
  • Both that run and "Permissive-Test" at line 105 assert tr.ReturnCode = 0.

I tried to settle this empirically and could not: tls_verify_base is https-inbound only, so on Fedora 45 it dies at the client handshake before the origin leg matters. On OpenSSL 3 it passes 4/4 with this patch, so the patch does not break it.

So the ask is one sentence in the description saying which of these is true:

  1. the patch is deliberately scoped to what was reachable, and these 25 files are known-remaining, or
  2. the trigger is narrower than the description states and they genuinely don't need it.

If it's (1), that's a perfectly good scope and worth stating plainly so the next person doesn't have to rediscover the list. If it's (2), the real precondition is the interesting fact and belongs in the description.

Verified: the mechanism, against the source

Everything load-bearing in the description holds up:

  • fastopen_bread() in src/iocore/net/BIO_fastopen.cc returns the read result and never sets BIO_FLAGS_IN_EOF, while fastopen_ctrl forwards every command — BIO_CTRL_EOF included — to BIO_s_socket()'s ctrl, which tests exactly that flag. grep -rn BIO_FLAGS_IN_EOF src/ include/ returns zero hits: ATS never sets it anywhere. Outbound setup is SSLNetVConnection.cc:120.
  • HttpTunnel::producer_handler_dechunked() switches on VC_EVENT_READ_COMPLETE, HTTP_TUNNEL_EVENT_PRECOMPLETE, VC_EVENT_EOS, VC_EVENT_READ_READY — no VC_EVENT_ERROR, no default. producer_handler_chunked() likewise skips it and returns early via default. Worth noting the asymmetry you didn't mention: the chunked handler does handle VC_EVENT_INACTIVITY_TIMEOUT and the dechunked one does not.
  • HttpSM::is_http_server_eos_truncation() returns false when content length is UNDEFINED_COUNT, per its own "No C-L : read success" table.

I also isolated the version divergence outside ATS, in a ~200-line probe that rebuilds your BIO: a custom BIO whose bread returns the read() result and whose ctrl delegates to BIO_s_socket(), with a server that sends an unframed response and closes without close_notify.

BIO OpenSSL 3.6.4 OpenSSL 4.0.3
stock socket BIO SSL_ERROR_SSL, BIO_eof=1, "unexpected eof while reading" identical
ATS-style BIO ret=-1, SSL_ERROR_SYSCALL, BIO_eof=0, errno=0, empty error queue ret=0, SSL_ERROR_SSL, BIO_eof=1, "unexpected eof while reading"

The stock-BIO row is the useful one: the "unexpected EOF is an error" policy is already live in OpenSSL 3. What changed in 4 is that the legacy-read adapter stopped compensating for a BIO that fails to report EOF. That points the core fix at fastopen_bread(): setting BIO_FLAGS_IN_EOF on a zero-length read would make 3 and 4 agree and let ATS detect the unexpected EOF on both, which looks smaller than reworking the tunnel handlers.

Verified: slow_server.yaml's deleted Content-Length: 16 was already dead

This is a better change than the description claims. A YAML merge key followed by a local headers: replaces the merged mapping rather than deep-merging it, and all six sessions define their own headers:. I confirmed the semantics on a minimal case rather than asserting them: anchor {Content-Length: 16, Connection: close} plus local {X-Response: 1} resolves to {'fields': [['X-Response', 1]]} — the anchor's fields are gone.

So those two lines applied to no session and the responses were already unframed. Deleting them removes a real trap, and the per-session Content-Length: 0 is the actual fix. Same for slow_server_uds.yaml.

Verified: the AuTest 2of4 failure is infrastructure, ignore it

For the record, since it is red on the PR: that shard (autest 44495) died in git fetch, not in a test. The console has rotated out, but it ran 8.8 minutes against a median of 38.2 for shard runs that actually fail a test and 35.7 for ones that pass — below the 27.1-minute floor of every real test failure in my 450-run sample. #13759 took the identical failure 38 seconds earlier. Nothing to do here.

Non-blocking: two remap golds lost a chunked assertion they didn't need to

In tests/gold_tests/remap/remap_https.test.py, server (line 27) is plaintext — only server2 is ssl=True. Line 56 maps www.example.com to http://127.0.0.1:{server.Variables.Port}, and the runs checked against gold/remap-https-200.gold (lines 86, 92, 99) and remap-https-200_3.gold (line 106) all go there. Only remap-https-200_2.gold (line 125, www.anotherexample.com) has a TLS origin leg.

Because both origins share one response_header dict, framing the TLS one also framed the plaintext one, and those two golds dropped < Transfer-Encoding: chunked — an assertion about ATS's unknown-length-to-chunked conversion that OpenSSL 4 cannot affect. Giving server2 its own response dict would frame exactly what needs it and leave both golds intact. Same in remap_yaml/remap_https_yaml.test.py.

Not blocking: remap/gold/remap-200.gold and friends still cover that conversion.

Non-blocking: please file an issue for the HttpTunnel bug

There is no open issue for it — I searched. Right now this PR description is the only record of a real, verified defect, and merging buries it in a closed PR while also removing the accidental reproduction that was surfacing it. That combination is how a known bug becomes an unknown one.

A tracking issue with the three source citations above would cost you a few minutes and would give the eventual fix something to land against. Ideally with a deterministic regression test — tls_origin_post_abort.test.py already drives VC_EVENT_ERROR into the request-body tunnel with a raw-socket TLS origin, so the response-side analogue has a template.

Nit: the Host in the new addResponse keys is decorative

DEFAULT_LOOKUP_KEY = '{PATH}' (tests/gold_tests/autest-site/microserver.test.ext:31), and none of these tests override it, so the registrations match on path alone. They do work — I chased this expecting the opposite and was wrong.

But the new calls read as host-scoped when they aren't. In the tls_client_cert* files, server2.addResponse(..., request_header, ...) picks up whichever request_header was last assigned (the bar.com one) while serving requests for other hosts; in tls_verify_override*.test.py the fallback is keyed on request_foo_header while the request that needs it is host: random.com. A one-line comment, or a dedicated request object, would stop the next person from assuming the Host matters — and would save them if anyone ever passes a {HOST} lookup key on these origins.

Relatedly, "expected default 404" in those comments is no longer quite right: it's now an explicitly registered catch-all for /, not microserver's built-in default.

Preparing ATS CI to move from fedora:44 to fedora:45 exposed TLS AuTest
failures with OpenSSL 4. Empty origin responses without a body length
rely on TLS shutdown for completion. Closing without close_notify now
surfaces as a TLS read error, which can leave clients waiting.

This patch frames empty TLS origin responses and explicitly registered
fallback 404 responses with Content-Length: 0. Separate plaintext remap
fixtures retain coverage of ATS's chunked conversion. The core TLS read
error handling defect is tracked separately in apache#13784.

Co-authored-by: GPT-6.1 Sol High
@bneradt
bneradt force-pushed the fix-empty-tls-replay-responses branch from 10e4e3b to 2e3803c Compare October 2, 2026 15:06
Copilot AI balanced review requested due to automatic review settings October 2, 2026 15:06
@bneradt

bneradt commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@bryancall I reproduced the environment and protocol differences and updated the patch and description.

  • Inbound handshake reconciliation: our validation checkout included Handle OpenSSL 4 handshake buffer exhaustion #13761, now merged as fe7cfc94278d05e0eb772f08a14628a0141437e3. The standalone head of this PR predates that fix. I rebuilt the same OpenSSL 4.0.2 ATS configuration with only that patch removed/restored: without it the first remap_https HTTPS run stalls after curl's handshake and reaches a three-second diagnostic client deadline; restoring it makes all eight runs pass. The description now explicitly identifies that prerequisite and does not claim that this test-only PR alone makes the Fedora 45 suite green. These runs still use Fedora's openssl-libs-4.0.2-2.fc45.aarch64, not 4.0.3.
  • Remaining fixtures: the patch deliberately scopes the framing changes to the affected empty responses and is not a comprehensive audit of every TLS origin. I reran the unchanged tls_verify_base: all four runs pass while curl negotiates HTTP/2. A diagnostic copy forcing HTTP/1.1 hangs on its first empty 200 response and exits curl 28 at the three-second deadline. Thus the HTTPS-only fixtures are not necessarily hidden behind the handshake failure once Handle OpenSSL 4 handshake buffer exhaustion #13761 is present; the negotiated client protocol also changes the completion path. The description now names the remaining unframed registrations as follow-up work and does not claim they are safe. HTTP/2 success does not establish the validity of the abrupt TLS origin shutdown either.
  • Plaintext remap coverage: the plaintext and TLS origins now have separate response objects in both remap variants. Only the TLS origin is framed. I restored the plaintext remap-https-200.gold and _3.gold files to their original chunked-response assertions.
  • Fallback registrations: the comments now identify an explicitly registered / response and state that the default lookup key is {PATH}, so the response applies to every Host header. They no longer describe the registrations as microserver's built-in default.
  • Other observations: the description explains why the timeout replay anchor's Content-Length: 16 was ineffective. The core tunnel defect is tracked in OpenSSL 4: TLS origin read errors leave incomplete HTTP/1.1 responses hanging #13784 with a standalone reproducer and the source citations; this PR does not fix it. The AuTest 2of4 rerun has also passed (build 44597).

Formatting and the incremental build succeeded. All 18 final focused AuTests passed against the native ARM Fedora 45/OpenSSL 4.0.2 validation installation, including the updated remap golds, client-certificate tests, verification/override tests, certificate selection, inactive-client timeout, and proxy protocol.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The fixture and gold-file changes consistently provide valid empty-response framing without altering the intended plaintext chunking coverage.

Review effort: Balanced
Findings: None

@bryancall bryancall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Approve

Both blocking items are answered, and the answer to the first one is better than I expected: there was a prerequisite I had no way to see from the PR, and I have now reproduced your result with it. Thank you for the controlled removed/restored comparison — that is the experiment that settles it.

I re-ran the reviewer panel on the delta only (14 files, +30/-18). Three reviewers, no critical or important findings between them. Six smaller items were raised; I dropped four that did not survive checking and merged the other two into one non-blocking note below.

Verified: ask 1, the Fedora 45 claim is reconciled, and I reproduced it

#13761 (fe7cfc9427) is the piece I was missing, and the reason is mechanical rather than anyone's mistake: I pinned my worktree to this PR's merge-base, 2fa4963926, which is the right base for reviewing the PR in isolation and predates that commit by design. So the tree I tested genuinely did not have the fix.

Its diff is exactly the code path I had landed on. update_rbio() keyed on BIO_eof(SSL_get_rbio(this->ssl)) and now keys on BIO_ctrl_pending(...) == 0; the same substitution lands in sslServerHandShakeEvent(). That is the function I named as leaving read.triggered == 0 with nothing left to wake the vc, so your description's "retains the exhausted handshake buffer and never resumes reading" and my "stuck in SSL_HANDSHAKE_WANT_READ until the 30 s timer" are the same event seen from two ends.

Reproduced on the same rig as my first review, with one variable changed:

tree OpenSSL result
2fa4963926 + this PR (what I reviewed) 4.0.2 2 of 7 pass
2fa4963926 + fe7cfc9427 + this PR 4.0.2 7 of 7 pass

remap_https goes 8/8, and so do tls_verify_base, tls_verify and tls_check_cert_selection, which were the three that failed at run 0 before. Build was RelWithDebInfo, GCC, openssl-libs-4.0.2-2.fc45 on x86_64 rather than your aarch64, in a rootless container; the test set was tls_verify_base tls_verify_override_base tls_verify_override tls_verify tls_check_cert_selection remap_https tls_client_cert.

The description now naming #13761 as a prerequisite, and saying plainly that this PR alone does not make the suite green, is the right resolution. Nobody can reproduce this from the PR head without that sentence.

Verified: ask 2, the scope is stated, and the remaining fixtures really are latent

The description now says the framing is deliberately scoped, that the roughly 47 registrations across 25 files are not claimed to be safe, and that they need separate auditing. That is option 1 of the two I asked you to choose between, stated explicitly. Good.

Your mechanism for why they were not reachable is better than the one I offered, and mine was wrong. I had guessed the HTTPS-only fixtures were hidden behind the inbound handshake failure. You found it is the negotiated client protocol, which is a different and more interesting fact, so I tested it: same build, same OpenSSL 4.0.2, #13761 applied, this PR applied, tls_verify_base untouched.

  • As it ships, curl negotiates h2 and all four runs pass.
  • A diagnostic copy with --http1.1 added to each MakeCurlCommand fails on its first run with curl: (18) transfer closed with outstanding read data remaining, after ALPN: server accepted http/1.1 and Request completely sent off.

That is the same signature the base tree gives for the fixtures this PR does fix, on an origin registration this PR does not touch. So the remaining set is latent, the gate is the client protocol, and the description's refusal to treat h2 success as proof of correctness is right. I withdraw my inbound-handshake explanation for that set.

Fixed: ask 3, the two remap golds are back and the split is clean

remap_https.test.py and remap_https_yaml.test.py now give the plaintext origin response_header and the TLS origin tls_response_header, with Content-Length: 0 on the latter only, and a comment at line 36 recording why the two differ.

I checked the golds by blob rather than by eye: remap/gold/remap-https-200.gold, remap-https-200_3.gold and both remap_yaml/ copies are byte-identical to their 2fa4963926 versions, so < Transfer-Encoding: chunked is back in its original position. remap-https-200_2.gold is untouched and still asserts Content-Length: 0, which matches server2 being the only framed origin. Tracing run index to Host to remap rule to origin to gold: runs 2-4 and run 5 reach the plaintext origin and check against the chunked golds, run 8 reaches the TLS origin and checks _2.gold, and the three 404 runs never touch either origin. No run's gold now disagrees with the origin it reaches, and the remap/ and remap_yaml/ pairs are identical.

Fixed: ask 4, the tunnel defect is tracked

#13784 is open with a standalone reproducer and the source citations. That was the thing I most wanted out of this PR, because merging it removes the accidental reproduction that was surfacing the bug. The description's warning that curl exit 28 is a timeout and not a prompt rejection is a useful thing to have written down next to it.

Fixed: ask 5, the addResponse comments

The eight tls/*.test.py comments now say the registration is an explicit / response matched on the microserver's default {PATH} lookup key, so it applies regardless of Host. I confirmed DEFAULT_LOOKUP_KEY = '{PATH}' at tests/gold_tests/autest-site/microserver.test.ext:31, that none of the eight passes lookup_key=, and that the tests demonstrate it: in tls_client_cert.test.py the /case2 requests arrive as both host:example.com and host:bar.com and both get the response registered under a Host: bar.com request dict. The old "expected default 404" wording is gone from all eight; a repo-wide grep finds no survivors.

Non-blocking: the new comments dropped the one clause that said why

The wording this PR previously had — "without relying on TLS connection closure" — was the only thing in the comment explaining why the registration exists at all. The new text explains the matching rule instead, and "framed" is now carrying the rationale on its own. Someone pruning test fixtures in a year could read the new comment and conclude the registration is redundant with microserver's built-in 404, which is exactly backwards.

Relatedly, writing {PATH} into eight comments pins a value that lives in one place. If that default ever grows a Host component, all eight comments become wrong silently, and this is partly my fault for asking for the clarification in the first place.

One clause fixes both, something like: "Registered explicitly so the 404 is framed and does not depend on the TLS connection closing; the microserver's default lookup key does not include Host, so this matches any Host." Entirely your call, and not worth another round on its own.

Verified: CI is green on the pushed revision

All 14 checks pass on 2e3803c26, AuTest 0-3of4 included (44638, 44639, 44640, 44641). The 44597 rerun you cited has already rotated out of Jenkins, but the current run is stronger evidence than that one was. There are no unresolved review threads, and Copilot's second pass recommends approval with no findings.

@maskit maskit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't look at the tests but the tests pass with BoringSSL as well.

@bneradt
bneradt merged commit 3266bd0 into apache:master Oct 3, 2026
14 checks passed
@bneradt
bneradt deleted the fix-empty-tls-replay-responses branch October 3, 2026 04:09
@github-project-automation github-project-automation Bot moved this to For v10.2.1 in ATS v10.2.x Oct 3, 2026
cmcfarlen pushed a commit that referenced this pull request Oct 7, 2026
Preparing ATS CI to move from fedora:44 to fedora:45 exposed TLS AuTest
failures with OpenSSL 4. Empty origin responses without a body length
rely on TLS shutdown for completion. Closing without close_notify now
surfaces as a TLS read error, which can leave clients waiting.

This patch frames empty TLS origin responses and explicitly registered
fallback 404 responses with Content-Length: 0. Separate plaintext remap
fixtures retain coverage of ATS's chunked conversion. The core TLS read
error handling defect is tracked separately in #13784.

Co-authored-by: GPT-6.1 Sol High
(cherry picked from commit 3266bd0)
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.1 Oct 7, 2026
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to the 10.2.x branch as e3834b6 for the 10.2.1 release.

bneradt added a commit that referenced this pull request Nov 3, 2026
Two Uranium tests fail on Fedora 45, which blocks moving the Fedora CI
jobs from fedora:44 to fedora:45. Fedora 45's curl 8.21 reworded its
verbose CONNECT message from "Establish HTTP proxy tunnel" to
"Establishing HTTP proxy tunnel", so test_connect_curl no longer
matches its gold file. test_tls_verify_override_sni hangs because its
TLS origins answer with a 200 that has neither a Content-Length nor a
body, which leaves the HTTP/1.1 request waiting until it times out
under OpenSSL 4. #13763 framed this response in the AuTest version of
the test, but that change did not carry over to the pytest conversion.

This patch makes the gold line accept either curl wording and restores
the Content-Length: 0 framing on the origin response. Both changes are
confined to the tests, and the gold wildcard still matches the wording
older curl versions print.

Co-authored-by: Claude Opus 5.5 Medium <[email protected]>
bneradt added a commit to bneradt/trafficserver that referenced this pull request Nov 4, 2026
Two Uranium tests fail on Fedora 45, which blocks moving the Fedora CI
jobs from fedora:44 to fedora:45. Fedora 45's curl 8.21 reworded its
verbose CONNECT message from "Establish HTTP proxy tunnel" to
"Establishing HTTP proxy tunnel", so test_connect_curl no longer
matches its gold file. test_tls_verify_override_sni hangs because its
TLS origins answer with a 200 that has neither a Content-Length nor a
body, which leaves the HTTP/1.1 request waiting until it times out
under OpenSSL 4. apache#13763 framed this response in the AuTest version of
the test, but that change did not carry over to the pytest conversion.

This patch makes the gold line accept either curl wording and restores
the Content-Length: 0 framing on the origin response. Both changes are
confined to the tests, and the gold wildcard still matches the wording
older curl versions print.

Co-authored-by: Claude Opus 5.5 Medium <[email protected]>
(cherry picked from commit e7c5978)
cmcfarlen pushed a commit that referenced this pull request Nov 6, 2026
Two Uranium tests fail on Fedora 45, which blocks moving the Fedora CI
jobs from fedora:44 to fedora:45. Fedora 45's curl 8.21 reworded its
verbose CONNECT message from "Establish HTTP proxy tunnel" to
"Establishing HTTP proxy tunnel", so test_connect_curl no longer
matches its gold file. test_tls_verify_override_sni hangs because its
TLS origins answer with a 200 that has neither a Content-Length nor a
body, which leaves the HTTP/1.1 request waiting until it times out
under OpenSSL 4. #13763 framed this response in the AuTest version of
the test, but that change did not carry over to the pytest conversion.

This patch makes the gold line accept either curl wording and restores
the Content-Length: 0 framing on the origin response. Both changes are
confined to the tests, and the gold wildcard still matches the wording
older curl versions print.

Co-authored-by: Claude Opus 5.5 Medium <[email protected]>
(cherry picked from commit e7c5978)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Picked v10.2.1

Development

Successfully merging this pull request may close these issues.

5 participants