github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/request_arg.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  )
     8  
     9  type RequestArgCheckpoint struct {
    10  	Checkpoint
    11  }
    12  
    13  func (this *RequestArgCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    14  	return req.WAFRaw().URL.Query().Get(param), hasRequestBody, nil, nil
    15  }
    16  
    17  func (this *RequestArgCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    18  	if this.IsRequest() {
    19  		return this.RequestValue(req, param, options, ruleId)
    20  	}
    21  	return
    22  }
    23  
    24  func (this *RequestArgCheckpoint) CacheLife() utils.CacheLife {
    25  	return utils.CacheMiddleLife
    26  }