github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/request_header.go (about) 1 package checkpoints 2 3 import ( 4 "github.com/TeaOSLab/EdgeNode/internal/waf/requests" 5 "github.com/TeaOSLab/EdgeNode/internal/waf/utils" 6 "github.com/iwind/TeaGo/maps" 7 "strings" 8 ) 9 10 type RequestHeaderCheckpoint struct { 11 Checkpoint 12 } 13 14 func (this *RequestHeaderCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) { 15 v, found := req.WAFRaw().Header[param] 16 if !found { 17 value = "" 18 return 19 } 20 value = strings.Join(v, ";") 21 return 22 } 23 24 func (this *RequestHeaderCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) { 25 if this.IsRequest() { 26 return this.RequestValue(req, param, options, ruleId) 27 } 28 return 29 } 30 31 func (this *RequestHeaderCheckpoint) CacheLife() utils.CacheLife { 32 return utils.CacheMiddleLife 33 }