From 205d22d21efea3bdc986ce0346a48cebfab1cbcb Mon Sep 17 00:00:00 2001 From: Jon Friesen Date: Wed, 23 Apr 2025 13:54:46 -0600 Subject: [PATCH] Includes TransferEncodings to plugins if present Also reduces the diagnostic verbosity and add some vscode configs to make ebpf dev a bit easier out of the gate. --- .vscode/c_cpp_properties.json | 19 +++++++++++++++++++ pkg/plugins/connection.go | 4 ++++ pkg/stream/protocols/http1/diagnostics.go | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .vscode/c_cpp_properties.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..1e70318 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,19 @@ +{ + "configurations": [ + { + "name": "libbpf", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/bpf/tap/**", + ], + "defines": [ + "__TARGET_ARCH_arm64" // this enables lsp for headers on arm64 when using macos + ], + "compilerPath": "${default}", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "${default}" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/pkg/plugins/connection.go b/pkg/plugins/connection.go index 76ba727..0aa0a64 100644 --- a/pkg/plugins/connection.go +++ b/pkg/plugins/connection.go @@ -4,6 +4,7 @@ import ( "context" "net/http" "strconv" + "strings" "github.com/qpoint-io/qtap/pkg/plugins/metadata" "github.com/qpoint-io/qtap/pkg/services" @@ -97,6 +98,9 @@ func (c *Connection) SetRequest(req *http.Request) { func (c *Connection) SetResponse(res *http.Response) { // extract URL pieces and set them as headers res.Header.Set(":status", strconv.Itoa(res.StatusCode)) + if len(res.TransferEncoding) > 0 { + res.Header.Set(":transfer-encoding", strings.Join(res.TransferEncoding, ",")) + } // set the response and response body c.resp = res diff --git a/pkg/stream/protocols/http1/diagnostics.go b/pkg/stream/protocols/http1/diagnostics.go index 8ff9a15..ba87973 100644 --- a/pkg/stream/protocols/http1/diagnostics.go +++ b/pkg/stream/protocols/http1/diagnostics.go @@ -129,7 +129,7 @@ func (d *DiagnosticWriter) Close() error { return nil // Nothing to do if already closed or disabled initially } - d.logger.Info("Closing diagnostic writer", zap.Any("payloads", d.payloads)) + d.logger.Info("Closing diagnostic writer", zap.Int("payload_count", len(d.payloads))) // Lock the mutex to safely access and modify shared state (payloads, enabled) d.payloadsMutex.Lock()