mirror of
https://github.com/caddyserver/caddy.git
synced 2025-11-02 06:36:29 +08:00
use a more modern writing style to simplify code (#7182)
Signed-off-by: joemicky <joemickychang@outlook.com> Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
@ -452,8 +452,7 @@ func (rw *responseWriter) init() {
|
||||
|
||||
func hasVaryValue(hdr http.Header, target string) bool {
|
||||
for _, vary := range hdr.Values("Vary") {
|
||||
vals := strings.Split(vary, ",")
|
||||
for _, val := range vals {
|
||||
for val := range strings.SplitSeq(vary, ",") {
|
||||
if strings.EqualFold(strings.TrimSpace(val), target) {
|
||||
return true
|
||||
}
|
||||
@ -478,7 +477,7 @@ func AcceptedEncodings(r *http.Request, preferredOrder []string) []string {
|
||||
|
||||
prefs := []encodingPreference{}
|
||||
|
||||
for _, accepted := range strings.Split(acceptEncHeader, ",") {
|
||||
for accepted := range strings.SplitSeq(acceptEncHeader, ",") {
|
||||
parts := strings.Split(accepted, ";")
|
||||
encName := strings.ToLower(strings.TrimSpace(parts[0]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user