优化请求限制逻辑,连接关闭时自动终止内容发送

This commit is contained in:
GoEdgeLab
2022-11-29 19:14:46 +08:00
parent 10da1a7a09
commit 7f04354be2
2 changed files with 13 additions and 2 deletions

View File

@@ -132,7 +132,7 @@ func (this *HTTPWriter) Prepare(resp *http.Response, size int64, status int, ena
this.req.web.RequestLimit != nil &&
this.req.web.RequestLimit.IsOn &&
this.req.web.RequestLimit.OutBandwidthPerConnBytes() > 0 {
this.writer = writers.NewRateLimitWriter(this.writer, this.req.web.RequestLimit.OutBandwidthPerConnBytes())
this.writer = writers.NewRateLimitWriter(this.req.RawReq.Context(), this.writer, this.req.web.RequestLimit.OutBandwidthPerConnBytes())
}
return