mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-07 18:30:25 +08:00
优化SSE处理/优化超时设置
This commit is contained in:
@@ -461,7 +461,19 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId
|
||||
this.ProcessResponseHeaders(this.writer.Header(), resp.StatusCode)
|
||||
|
||||
// 是否需要刷新
|
||||
var shouldAutoFlush = this.reverseProxy.AutoFlush || this.RawReq.Header.Get("Accept") == "text/event-stream"
|
||||
var shouldAutoFlush = this.reverseProxy.AutoFlush || (resp.Header != nil && strings.Contains(resp.Header.Get("Content-Type"), "stream"))
|
||||
|
||||
// 设置当前连接为Persistence
|
||||
if shouldAutoFlush && this.nodeConfig != nil && this.nodeConfig.HasConnTimeoutSettings() {
|
||||
var requestConn = this.RawReq.Context().Value(HTTPConnContextKey)
|
||||
if requestConn == nil {
|
||||
return
|
||||
}
|
||||
requestClientConn, ok := requestConn.(ClientConnInterface)
|
||||
if ok {
|
||||
requestClientConn.SetIsPersistent(true)
|
||||
}
|
||||
}
|
||||
|
||||
// 准备
|
||||
var delayHeaders = this.writer.Prepare(resp, resp.ContentLength, resp.StatusCode, true)
|
||||
|
||||
Reference in New Issue
Block a user