From cdd24e91b4844ebe60e86a511ceba8046d9d5487 Mon Sep 17 00:00:00 2001 From: Kevin Pollet Date: Fri, 31 Jan 2025 12:00:05 +0100 Subject: [PATCH] Fix content-length header assertion Co-authored-by: Romain --- pkg/proxy/fast/connpool.go | 3 +-- pkg/proxy/fast/proxy_test.go | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/proxy/fast/connpool.go b/pkg/proxy/fast/connpool.go index f2efc88b6..f6357c59d 100644 --- a/pkg/proxy/fast/connpool.go +++ b/pkg/proxy/fast/connpool.go @@ -179,7 +179,6 @@ func (c *conn) handleResponse(r rwWithUpgrade) error { } res.Reset() - res.Header.Reset() res.Header.SetNoDefaultContentType(true) continue @@ -216,7 +215,7 @@ func (c *conn) handleResponse(r rwWithUpgrade) error { return nil } - hasContentLength := res.Header.Peek("Content-Length") != nil + hasContentLength := len(res.Header.Peek("Content-Length")) > 0 if hasContentLength && res.Header.ContentLength() == 0 { return nil diff --git a/pkg/proxy/fast/proxy_test.go b/pkg/proxy/fast/proxy_test.go index 563f411c1..4c4c158b1 100644 --- a/pkg/proxy/fast/proxy_test.go +++ b/pkg/proxy/fast/proxy_test.go @@ -307,8 +307,6 @@ func TestHeadRequest(t *testing.T) { } func TestNoContentLengthResponse(t *testing.T) { - t.Skip("Waiting for a fix") - backendListener, err := net.Listen("tcp", ":0") require.NoError(t, err)