mirror of
https://github.com/caddyserver/caddy.git
synced 2025-12-07 13:49:48 +00:00
encode: modernize, replace HasSuffix+TrimSuffix with CutSuffix (#7357)
Signed-off-by: ledigang <shuangcui@msn.com>
This commit is contained in:
parent
b9e6f3b227
commit
2cb426776c
1 changed files with 2 additions and 2 deletions
|
|
@ -168,8 +168,8 @@ func (enc *Encode) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyh
|
|||
// caches without knowing about our changes...
|
||||
if etag := r.Header.Get("If-None-Match"); etag != "" && !strings.HasPrefix(etag, "W/") {
|
||||
ourSuffix := "-" + encName + `"`
|
||||
if strings.HasSuffix(etag, ourSuffix) {
|
||||
etag = strings.TrimSuffix(etag, ourSuffix) + `"`
|
||||
if before, ok := strings.CutSuffix(etag, ourSuffix); ok {
|
||||
etag = before + `"`
|
||||
r.Header.Set("If-None-Match", etag)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue