@marcel91200 / caddy Mirror · read-only / commits / 9ab09433
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 14:30 UTC

encode: Slight fix for the previous commit

Matthew Holt committed Apr 17, 2024 at 19:59 UTC 9ab09433deba62f9f2b37d824570926f7ee69312
1 file changed +5 -2
modules/caddyhttp/encode/encode.go
+5 -2
@@ -164,8 +164,11 @@ func (enc *Encode) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyh
164 // we have to strip our addition so the upstream handlers can still honor client
165 // caches without knowing about our changes...
166 if etag := r.Header.Get("If-None-Match"); etag != "" && !strings.HasPrefix(etag, "W/") {
167 - etag = strings.TrimSuffix(etag, "-"+encName+`"`) + `"`
168 - r.Header.Set("If-None-Match", etag)
167 + ourSuffix := "-" + encName + `"`
168 + if strings.HasSuffix(etag, ourSuffix) {
169 + etag = strings.TrimSuffix(etag, ourSuffix) + `"`
170 + r.Header.Set("If-None-Match", etag)
171 + }
172 }
173
174 break