Files
EdgeNode/internal/waf/checkpoints/response_header.go

35 lines
972 B
Go
Raw Permalink Normal View History

2020-10-08 15:06:42 +08:00
package checkpoints
import (
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
2023-10-11 12:21:10 +08:00
"github.com/TeaOSLab/EdgeNode/internal/waf/utils"
"github.com/iwind/TeaGo/maps"
2020-10-08 15:06:42 +08:00
)
2022-07-16 17:05:37 +08:00
// ResponseHeaderCheckpoint ${responseHeader.arg}
2020-10-08 15:06:42 +08:00
type ResponseHeaderCheckpoint struct {
Checkpoint
}
func (this *ResponseHeaderCheckpoint) IsRequest() bool {
return false
}
2023-10-11 12:21:10 +08:00
func (this *ResponseHeaderCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
2020-10-08 15:06:42 +08:00
value = ""
return
}
2023-10-11 12:21:10 +08:00
func (this *ResponseHeaderCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
2020-10-08 15:06:42 +08:00
if resp != nil && resp.Header != nil {
value = resp.Header.Get(param)
} else {
value = ""
}
return
}
2023-10-11 12:21:10 +08:00
func (this *ResponseHeaderCheckpoint) CacheLife() utils.CacheLife {
return utils.CacheMiddleLife
}