Skip to content

test: No CI test covers tunnel behaviour (server-first protocols, half-close) #1553

Closed

Description

@huang195

Problem

Nothing tests how a raw tunnel carries bytes in both directions with real protocol timing. #1544 slipped through this gap: through CONNECT, a server that speaks first hangs, and a half-close loses the reply.

What exists today

  • TestHandleTransparentConn_Tunnels (core/listener/forwardproxy/transparent_test.go) sends an upstream banner, but only through the transparent listener, with no TLS bridge, over a net.Pipe. That path never peeks the client's bytes, so it cannot see the hang.
  • No test calls CloseWrite() through a tunnel. The one CloseWrite in the forward-proxy tests (requestbodyfailure_test.go:164) is about request bodies.

Measured on main (43cf553)

Case Direct Through CONNECT
server speaks first, bridge off banner at 0 s banner at 0 s
server speaks first, bridge on banner at 0 s nothing after 8 s
client half-closes, then reads GOT 5 BYTES empty

Proposed test

A small table of tunnel behaviours:

  • Cases: server speaks first, client half-close then read, a large transfer in both directions at once, and a client that sends nothing then closes.
  • Paths: CONNECT with the bridge off, CONNECT with the bridge on to a port it does not bridge, and HandleTransparentConn over a real TCP pair.
  • Assert: each case behaves the same as a direct connection, within a short deadline. Also check that the tunnel rows' bytesUp/bytesDown match what crossed.

The reproduction source in #1544 is a working starting point.

How to land

The two failing rows go in with the #1544 fix.


Found while checking why the bugs from an experiment-driven audit (#1541–#1547) got past CI. Grounded on main at 43cf553.

Assisted-By: Claude (Anthropic AI) [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgo

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions