From bd046677e5537e1dca4f6d6d0c7d16e60704d087 Mon Sep 17 00:00:00 2001 From: Devin Carr Date: Fri, 3 Feb 2023 18:01:27 -0800 Subject: [PATCH] TUN-7158: Correct TCP tracing propagation Previously QUIC would send TCP tracing response header that was empty regardless if prompted from origintunneld. --- connection/quic.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/connection/quic.go b/connection/quic.go index 4c4a4207..c0db84d8 100644 --- a/connection/quic.go +++ b/connection/quic.go @@ -383,12 +383,16 @@ type streamReadWriteAcker struct { // AckConnection acks response back to the proxy. func (s *streamReadWriteAcker) AckConnection(tracePropagation string) error { - metadata := quicpogs.Metadata{ - Key: tracing.CanonicalCloudflaredTracingHeader, - Val: tracePropagation, + metadata := []quicpogs.Metadata{} + // Only add tracing if provided by origintunneld + if tracePropagation != "" { + metadata = append(metadata, quicpogs.Metadata{ + Key: tracing.CanonicalCloudflaredTracingHeader, + Val: tracePropagation, + }) } s.connectResponseSent = true - return s.WriteConnectResponseData(nil, metadata) + return s.WriteConnectResponseData(nil, metadata...) } // httpResponseAdapter translates responses written by the HTTP Proxy into ones that can be used in QUIC.