﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37319	GZipMiddleware should skip responses without body.	Vladimir Nani		"GZipMiddleware compresses responses with status 304 that are not allowed to have content body.

**Negative effect:**
- streaming response with 304 status code and empty body is passed to GZipMiddleware
- Middleware check doesnt apply for streaming response and proceeds with compression
- In situation where connections are pooled, for example with Traefik, the body is not read (according to rfc 9112). 
- The empty body compressed is left as a garbage in the sockets buffer. 
- When the socket is read for the next time instead of starting with ""HTTP"" it reads ""\x1f\x8b\x08\x08\x00\x00\x00\x00\x00\xffaaaa""
- The next unrelated request that reuses the socket fails with malformed http:


{{{
{""level"":""debug"",""error"":""net/http: HTTP/1.x transport connection broken: malformed HTTP version \""\\x1f\\x8b\\b\\b\\x00\\x00\\x00\\x00\\x00\\xffaaaaaaaaaaaaaaaa\\x00\\x03\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00HTTP/1.1\"""",""time"":""2026-09-04T12:33:17+02:00"",""caller"":""github.com/traefik/traefik/v3/pkg/proxy/httputil/proxy.go:117"",""message"":""500 Internal Server Error""}
}}}



**Proposal:**
Check for 204 and 304 and do not compress these responses.

https://www.rfc-editor.org/rfc/rfc9112.html#section-6.3-2.1

"	Uncategorized	new	Uncategorized	6.1	Normal		GZipMiddleware		Unreviewed	0	0	0	0	0	0
