DrFaust92 commented on code in PR #1115:
URL: https://github.com/apache/yunikorn-core/pull/1115#discussion_r3683106626


##########
pkg/webservice/gzip.go:
##########
@@ -78,6 +86,22 @@ func (d *deferredGzipResponseWriter) Write(b []byte) (int, 
error) {
        return n, err
 }
 
+// passThrough commits to sending the response uncompressed: it flushes any 
buffered
+// bytes to the underlying writer and marks the decision as final.
+func (d *deferredGzipResponseWriter) passThrough() {
+       d.decided = true

Review Comment:
   Good catch, added — but scoped to the encoded case.
   
   `Test_GzipMinCompressionSize` already asserts `Vary` must *not* be set when 
the response is not compressed, so adding it unconditionally in `passThrough` 
broke that test. The line I settled on: set `Vary` only when the response 
actually carries a `Content-Encoding`.
   
   That still closes the real gap — promhttp sets `Content-Encoding: gzip` but 
never `Vary` (nothing in `prometheus/promhttp` sets it), so a passed-through 
metrics response was going out compressed with no `Vary` at all, which lets a 
shared cache hand those bytes to a client that cannot decode them. A body we 
simply chose not to compress keeps neither header, as before.
   
   Happy to make it unconditional and update that assertion instead, if you 
think the existing expectation is the wrong one.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to