github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/checkpoint.go (about) 1 package checkpoints 2 3 import ( 4 "github.com/TeaOSLab/EdgeNode/internal/waf/requests" 5 "net/http" 6 ) 7 8 type Checkpoint struct { 9 priority int 10 } 11 12 func (this *Checkpoint) Init() { 13 14 } 15 16 func (this *Checkpoint) IsRequest() bool { 17 return true 18 } 19 20 func (this *Checkpoint) IsComposed() bool { 21 return false 22 } 23 24 func (this *Checkpoint) ParamOptions() *ParamOptions { 25 return nil 26 } 27 28 func (this *Checkpoint) Options() []OptionInterface { 29 return nil 30 } 31 32 func (this *Checkpoint) Start() { 33 34 } 35 36 func (this *Checkpoint) Stop() { 37 38 } 39 40 func (this *Checkpoint) SetPriority(priority int) { 41 this.priority = priority 42 } 43 44 func (this *Checkpoint) Priority() int { 45 return this.priority 46 } 47 48 func (this *Checkpoint) RequestBodyIsEmpty(req requests.Request) bool { 49 if req.WAFRaw().ContentLength == 0 { 50 return true 51 } 52 53 var method = req.WAFRaw().Method 54 if method == http.MethodHead || method == http.MethodGet { 55 return true 56 } 57 58 return false 59 }