mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-02-21 21:25:36 +08:00
静态分发增加例外URL、限制URL、排除隐藏文件等选项
This commit is contained in:
@@ -66,6 +66,19 @@ func (this *HTTPRequest) doRoot() (isBreak bool) {
|
||||
requestPath = this.uri[:questionMarkIndex]
|
||||
}
|
||||
|
||||
// except hidden files
|
||||
if this.web.Root.ExceptHiddenFiles &&
|
||||
(strings.Contains(requestPath, "/.") || strings.Contains(requestPath, "\\.")) {
|
||||
this.write404()
|
||||
return true
|
||||
}
|
||||
|
||||
// except and only files
|
||||
if !this.web.Root.MatchURL(this.URL()) {
|
||||
this.write404()
|
||||
return true
|
||||
}
|
||||
|
||||
// 去掉其中的奇怪的路径
|
||||
requestPath = strings.Replace(requestPath, "..\\", "", -1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user