From 145387b3dff07b7cde4868319a3fbb6476aea963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sat, 26 Oct 2024 04:59:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Alt-Svc=E5=A4=B4=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/nginx/setter.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/nginx/setter.go b/pkg/nginx/setter.go index 097712ab..102ade39 100644 --- a/pkg/nginx/setter.go +++ b/pkg/nginx/setter.go @@ -439,11 +439,13 @@ func (p *Parser) SetAltSvc(altSvc string) error { for _, dir := range old { if slices.Contains(dir.GetParameters(), "Alt-Svc") { foundFlag = true - directives = append(directives, &config.Directive{ - Name: dir.GetName(), - Parameters: []string{"Alt-Svc", altSvc}, - Comment: dir.GetComment(), - }) + if altSvc != "" { // 为空表示要删除 + directives = append(directives, &config.Directive{ + Name: dir.GetName(), + Parameters: []string{"Alt-Svc", altSvc}, + Comment: dir.GetComment(), + }) + } } else { directives = append(directives, &config.Directive{ Name: dir.GetName(),