TUN-7158: Correct TCP tracing propagation

Previously QUIC would send TCP tracing response header that was empty regardless if prompted from origintunneld.
This commit is contained in:
Devin Carr 2023-02-03 18:01:27 -08:00
parent 8a9f076a26
commit bd046677e5
1 changed files with 8 additions and 4 deletions

View File

@ -383,12 +383,16 @@ type streamReadWriteAcker struct {
// AckConnection acks response back to the proxy.
func (s *streamReadWriteAcker) AckConnection(tracePropagation string) error {
metadata := quicpogs.Metadata{
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.