github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/request_header_names.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 RequestHeaderNamesCheckpoint struct { 11 Checkpoint 12 } 13 14 func (this *RequestHeaderNamesCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) { 15 var headerNames = []string{} 16 for k := range req.WAFRaw().Header { 17 headerNames = append(headerNames, k) 18 } 19 value = strings.Join(headerNames, "\n") 20 return 21 } 22 23 func (this *RequestHeaderNamesCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) { 24 if this.IsRequest() { 25 return this.RequestValue(req, param, options, ruleId) 26 } 27 return 28 } 29 30 func (this *RequestHeaderNamesCheckpoint) CacheLife() utils.CacheLife { 31 return utils.CacheShortLife 32 }