mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-07 02:20:25 +08:00
29 lines
714 B
Go
29 lines
714 B
Go
package checkpoints
|
|
|
|
import (
|
|
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
|
|
"github.com/iwind/TeaGo/maps"
|
|
"strings"
|
|
)
|
|
|
|
type RequestHeaderCheckpoint struct {
|
|
Checkpoint
|
|
}
|
|
|
|
func (this *RequestHeaderCheckpoint) RequestValue(req *requests.Request, param string, options maps.Map) (value interface{}, sysErr error, userErr error) {
|
|
v, found := req.Header[param]
|
|
if !found {
|
|
value = ""
|
|
return
|
|
}
|
|
value = strings.Join(v, ";")
|
|
return
|
|
}
|
|
|
|
func (this *RequestHeaderCheckpoint) ResponseValue(req *requests.Request, resp *requests.Response, param string, options maps.Map) (value interface{}, sysErr error, userErr error) {
|
|
if this.IsRequest() {
|
|
return this.RequestValue(req, param, options)
|
|
}
|
|
return
|
|
}
|