WAF多个相同Key的cc2统计规则不再重复累加

This commit is contained in:
GoEdgeLab
2022-07-25 09:34:34 +08:00
parent e15d491b97
commit 4b55895428
57 changed files with 189 additions and 179 deletions

View File

@@ -24,12 +24,12 @@ func TestRequestJSONArgCheckpoint_RequestValue_Map(t *testing.T) {
//req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
checkpoint := new(RequestJSONArgCheckpoint)
t.Log(checkpoint.RequestValue(req, "name", nil))
t.Log(checkpoint.RequestValue(req, "age", nil))
t.Log(checkpoint.RequestValue(req, "Hello", nil))
t.Log(checkpoint.RequestValue(req, "", nil))
t.Log(checkpoint.RequestValue(req, "books", nil))
t.Log(checkpoint.RequestValue(req, "books.1", nil))
t.Log(checkpoint.RequestValue(req, "name", nil, 1))
t.Log(checkpoint.RequestValue(req, "age", nil, 1))
t.Log(checkpoint.RequestValue(req, "Hello", nil, 1))
t.Log(checkpoint.RequestValue(req, "", nil, 1))
t.Log(checkpoint.RequestValue(req, "books", nil, 1))
t.Log(checkpoint.RequestValue(req, "books.1", nil, 1))
body, err := ioutil.ReadAll(req.WAFRaw().Body)
if err != nil {
@@ -54,12 +54,12 @@ func TestRequestJSONArgCheckpoint_RequestValue_Array(t *testing.T) {
//req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
checkpoint := new(RequestJSONArgCheckpoint)
t.Log(checkpoint.RequestValue(req, "0.name", nil))
t.Log(checkpoint.RequestValue(req, "0.age", nil))
t.Log(checkpoint.RequestValue(req, "0.Hello", nil))
t.Log(checkpoint.RequestValue(req, "", nil))
t.Log(checkpoint.RequestValue(req, "0.books", nil))
t.Log(checkpoint.RequestValue(req, "0.books.1", nil))
t.Log(checkpoint.RequestValue(req, "0.name", nil, 1))
t.Log(checkpoint.RequestValue(req, "0.age", nil, 1))
t.Log(checkpoint.RequestValue(req, "0.Hello", nil, 1))
t.Log(checkpoint.RequestValue(req, "", nil, 1))
t.Log(checkpoint.RequestValue(req, "0.books", nil, 1))
t.Log(checkpoint.RequestValue(req, "0.books.1", nil, 1))
body, err := ioutil.ReadAll(req.WAFRaw().Body)
if err != nil {
@@ -84,12 +84,12 @@ func TestRequestJSONArgCheckpoint_RequestValue_Error(t *testing.T) {
//req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
checkpoint := new(RequestJSONArgCheckpoint)
t.Log(checkpoint.RequestValue(req, "0.name", nil))
t.Log(checkpoint.RequestValue(req, "0.age", nil))
t.Log(checkpoint.RequestValue(req, "0.Hello", nil))
t.Log(checkpoint.RequestValue(req, "", nil))
t.Log(checkpoint.RequestValue(req, "0.books", nil))
t.Log(checkpoint.RequestValue(req, "0.books.1", nil))
t.Log(checkpoint.RequestValue(req, "0.name", nil, 1))
t.Log(checkpoint.RequestValue(req, "0.age", nil, 1))
t.Log(checkpoint.RequestValue(req, "0.Hello", nil, 1))
t.Log(checkpoint.RequestValue(req, "", nil, 1))
t.Log(checkpoint.RequestValue(req, "0.books", nil, 1))
t.Log(checkpoint.RequestValue(req, "0.books.1", nil, 1))
body, err := ioutil.ReadAll(req.WAFRaw().Body)
if err != nil {