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

61 lines
916 B
Go
Raw Permalink Normal View History

2020-10-08 15:06:42 +08:00
package checkpoints
2022-03-16 17:06:26 +08:00
import (
"net/http"
2024-07-27 15:42:50 +08:00
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
2022-03-16 17:06:26 +08:00
)
2020-10-08 15:06:42 +08:00
type Checkpoint struct {
priority int
2020-10-08 15:06:42 +08:00
}
func (this *Checkpoint) Init() {
}
func (this *Checkpoint) IsRequest() bool {
return true
}
func (this *Checkpoint) IsComposed() bool {
return false
}
2020-10-08 15:06:42 +08:00
func (this *Checkpoint) ParamOptions() *ParamOptions {
return nil
}
func (this *Checkpoint) Options() []OptionInterface {
return nil
}
func (this *Checkpoint) Start() {
}
func (this *Checkpoint) Stop() {
}
2022-03-16 17:06:26 +08:00
func (this *Checkpoint) SetPriority(priority int) {
this.priority = priority
}
func (this *Checkpoint) Priority() int {
return this.priority
}
2022-03-16 17:06:26 +08:00
func (this *Checkpoint) RequestBodyIsEmpty(req requests.Request) bool {
if req.WAFRaw().ContentLength == 0 {
return true
}
var method = req.WAFRaw().Method
if method == http.MethodHead || method == http.MethodGet {
return true
}
return false
}