-
Notifications
You must be signed in to change notification settings - Fork 29
/
response_general_header_length.go
45 lines (34 loc) · 1.09 KB
/
response_general_header_length.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package checkpoints
import (
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/types"
)
type ResponseGeneralHeaderLengthCheckpoint struct {
Checkpoint
}
func (this *ResponseGeneralHeaderLengthCheckpoint) IsRequest() bool {
return false
}
func (this *ResponseGeneralHeaderLengthCheckpoint) IsComposed() bool {
return true
}
func (this *ResponseGeneralHeaderLengthCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value interface{}, hasRequestBody bool, sysErr error, userErr error) {
return
}
func (this *ResponseGeneralHeaderLengthCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map, ruleId int64) (value interface{}, hasRequestBody bool, sysErr error, userErr error) {
value = false
headers := options.GetSlice("headers")
if len(headers) == 0 {
return
}
length := options.GetInt("length")
for _, header := range headers {
v := req.WAFRaw().Header.Get(types.String(header))
if len(v) > length {
value = true
break
}
}
return
}