Skip to content

Commit

Permalink
fix: Alt-Svc头删除不正确
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Oct 25, 2024
1 parent f7c586e commit 145387b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/nginx/setter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 145387b

Please sign in to comment.