mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 15:00:26 +08:00
如果源站返回的内容长度为0,则不再尝试读取数据
This commit is contained in:
@@ -84,7 +84,6 @@ func (this *HTTPClientPool) Client(req *HTTPRequest, origin *serverconfigs.Origi
|
||||
if idleConns <= 0 {
|
||||
idleConns = numberCPU * 8
|
||||
}
|
||||
//logs.Println("[ORIGIN]max connections:", maxConnections)
|
||||
|
||||
// TLS通讯
|
||||
tlsConfig := &tls.Config{
|
||||
@@ -101,7 +100,7 @@ func (this *HTTPClientPool) Client(req *HTTPRequest, origin *serverconfigs.Origi
|
||||
}
|
||||
}
|
||||
|
||||
transport := &http.Transport{
|
||||
var transport = &http.Transport{
|
||||
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
// 支持TOA的连接
|
||||
toaConfig := sharedTOAManager.Config()
|
||||
|
||||
@@ -293,6 +293,13 @@ func (this *HTTPRequest) doReverseProxy() {
|
||||
this.writer.WriteHeader(resp.StatusCode)
|
||||
}
|
||||
|
||||
// 是否有内容
|
||||
if resp.ContentLength == 0 && len(resp.TransferEncoding) == 0 {
|
||||
_ = resp.Body.Close()
|
||||
this.writer.SetOk()
|
||||
return
|
||||
}
|
||||
|
||||
// 输出到客户端
|
||||
pool := this.bytePool(resp.ContentLength)
|
||||
buf := pool.Get()
|
||||
|
||||
Reference in New Issue
Block a user