mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-16 04:00:24 +00:00
优化无效重定向页面的过滤
This commit is contained in:
parent
ae746b9e67
commit
c263c11926
@ -384,9 +384,7 @@ func (pool *Pool) Handler() {
|
|||||||
status = true
|
status = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if pool.BaseCompare(bl) {
|
status = pool.BaseCompare(bl)
|
||||||
status = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if status {
|
if status {
|
||||||
@ -475,6 +473,15 @@ func (pool *Pool) PreCompare(resp *ihttp.Response) error {
|
|||||||
|
|
||||||
func (pool *Pool) BaseCompare(bl *pkg.Baseline) bool {
|
func (pool *Pool) BaseCompare(bl *pkg.Baseline) bool {
|
||||||
var status = -1
|
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
|
base, ok := pool.baselines[bl.Status] // 挑选对应状态码的baseline进行compare
|
||||||
if !ok {
|
if !ok {
|
||||||
if pool.index != nil {
|
if pool.index != nil {
|
||||||
|
@ -20,7 +20,7 @@ var (
|
|||||||
WhiteStatus = []int{200}
|
WhiteStatus = []int{200}
|
||||||
BlackStatus = []int{400, 410}
|
BlackStatus = []int{400, 410}
|
||||||
FuzzyStatus = []int{403, 404, 500, 501, 502, 503}
|
FuzzyStatus = []int{403, 404, 500, 501, 502, 503}
|
||||||
WAFStatus = []int{493, 418, 1020}
|
WAFStatus = []int{493, 418, 1020, 406}
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -15,6 +15,7 @@ const (
|
|||||||
ErrRedirect
|
ErrRedirect
|
||||||
ErrCompareFailed
|
ErrCompareFailed
|
||||||
ErrFuzzyCompareFailed
|
ErrFuzzyCompareFailed
|
||||||
|
ErrFuzzyRedirect
|
||||||
ErrCustomCompareFailed
|
ErrCustomCompareFailed
|
||||||
ErrCustomFilter
|
ErrCustomFilter
|
||||||
)
|
)
|
||||||
@ -35,6 +36,8 @@ func (e ErrorType) Error() string {
|
|||||||
return "compare failed"
|
return "compare failed"
|
||||||
case ErrFuzzyCompareFailed:
|
case ErrFuzzyCompareFailed:
|
||||||
return "fuzzy compare failed"
|
return "fuzzy compare failed"
|
||||||
|
case ErrFuzzyRedirect:
|
||||||
|
return "fuzzy redirect"
|
||||||
case ErrCustomCompareFailed:
|
case ErrCustomCompareFailed:
|
||||||
return "custom compare failed"
|
return "custom compare failed"
|
||||||
case ErrCustomFilter:
|
case ErrCustomFilter:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user