mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-05 17:40:26 +08:00
实现请求连接数等限制
This commit is contained in:
@@ -207,6 +207,14 @@ func (this *HTTPRequest) Do() {
|
||||
|
||||
// 开始调用
|
||||
func (this *HTTPRequest) doBegin() {
|
||||
// 处理request limit
|
||||
if this.web.RequestLimit != nil &&
|
||||
this.web.RequestLimit.IsOn {
|
||||
if this.doRequestLimit() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 处理requestBody
|
||||
if this.RawReq.ContentLength > 0 &&
|
||||
this.web.AccessLogRef != nil &&
|
||||
@@ -441,6 +449,11 @@ func (this *HTTPRequest) configureWeb(web *serverconfigs.HTTPWebConfig, isTop bo
|
||||
this.web.Auth = web.Auth
|
||||
}
|
||||
|
||||
// request limit
|
||||
if web.RequestLimit != nil && (web.RequestLimit.IsPrior || isTop) {
|
||||
this.web.RequestLimit = web.RequestLimit
|
||||
}
|
||||
|
||||
// 重写规则
|
||||
if len(web.RewriteRefs) > 0 {
|
||||
for index, ref := range web.RewriteRefs {
|
||||
|
||||
Reference in New Issue
Block a user