mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
优化无效重定向页面的过滤
This commit is contained in:
parent
ae746b9e67
commit
c263c11926
@ -384,9 +384,7 @@ func (pool *Pool) Handler() {
|
||||
status = true
|
||||
}
|
||||
} else {
|
||||
if pool.BaseCompare(bl) {
|
||||
status = true
|
||||
}
|
||||
status = pool.BaseCompare(bl)
|
||||
}
|
||||
|
||||
if status {
|
||||
@ -475,6 +473,15 @@ func (pool *Pool) PreCompare(resp *ihttp.Response) error {
|
||||
|
||||
func (pool *Pool) BaseCompare(bl *pkg.Baseline) bool {
|
||||
var status = -1
|
||||
|
||||
// 30x状态码的特殊处理
|
||||
if strings.HasSuffix(bl.RedirectURL, bl.Url.Path+"/") {
|
||||
bl.Reason = ErrFuzzyRedirect.Error()
|
||||
pool.putToFuzzy(bl)
|
||||
return false
|
||||
}
|
||||
|
||||
// 使用与baseline相同状态码, 需要在fuzzystatus中提前配置
|
||||
base, ok := pool.baselines[bl.Status] // 挑选对应状态码的baseline进行compare
|
||||
if !ok {
|
||||
if pool.index != nil {
|
||||
|
@ -20,7 +20,7 @@ var (
|
||||
WhiteStatus = []int{200}
|
||||
BlackStatus = []int{400, 410}
|
||||
FuzzyStatus = []int{403, 404, 500, 501, 502, 503}
|
||||
WAFStatus = []int{493, 418, 1020}
|
||||
WAFStatus = []int{493, 418, 1020, 406}
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -15,6 +15,7 @@ const (
|
||||
ErrRedirect
|
||||
ErrCompareFailed
|
||||
ErrFuzzyCompareFailed
|
||||
ErrFuzzyRedirect
|
||||
ErrCustomCompareFailed
|
||||
ErrCustomFilter
|
||||
)
|
||||
@ -35,6 +36,8 @@ func (e ErrorType) Error() string {
|
||||
return "compare failed"
|
||||
case ErrFuzzyCompareFailed:
|
||||
return "fuzzy compare failed"
|
||||
case ErrFuzzyRedirect:
|
||||
return "fuzzy redirect"
|
||||
case ErrCustomCompareFailed:
|
||||
return "custom compare failed"
|
||||
case ErrCustomFilter:
|
||||
|
Loading…
x
Reference in New Issue
Block a user