mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-10 12:00:28 +08:00
修复内容为空时无法缓存的Bug
This commit is contained in:
@@ -328,7 +328,12 @@ func (this *HTTPRequest) doReverseProxy() {
|
||||
|
||||
// 是否有内容
|
||||
if resp.ContentLength == 0 && len(resp.TransferEncoding) == 0 {
|
||||
// 即使内容为0,也需要读取一次,以便于触发相关事件
|
||||
var buf = utils.BytePool4k.Get()
|
||||
_, _ = io.CopyBuffer(this.writer, resp.Body, buf)
|
||||
utils.BytePool4k.Put(buf)
|
||||
_ = resp.Body.Close()
|
||||
|
||||
this.writer.SetOk()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -836,7 +836,7 @@ func (this *HTTPWriter) HeaderData() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
resp := &http.Response{}
|
||||
var resp = &http.Response{}
|
||||
resp.Header = this.Header()
|
||||
if this.statusCode == 0 {
|
||||
this.statusCode = http.StatusOK
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
package readers
|
||||
|
||||
import "io"
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
type TeeReaderCloser struct {
|
||||
r io.Reader
|
||||
|
||||
Reference in New Issue
Block a user