实现WAF统计

This commit is contained in:
GoEdgeLab
2021-01-26 18:42:46 +08:00
parent dfb5ad6f78
commit a1d8c1bbf4
5 changed files with 72 additions and 22 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/iwind/TeaGo/Tea"
"github.com/iwind/TeaGo/logs"
"io"
"io/fs"
"mime"
"net/http"
"net/url"
@@ -100,7 +101,8 @@ func (this *HTTPRequest) doRoot() (isBreak bool) {
stat, err := os.Stat(filePath)
if err != nil {
if os.IsNotExist(err) {
_, isPathError := err.(*fs.PathError)
if os.IsNotExist(err) || isPathError {
if this.web.Root.IsBreak {
this.write404()
return true