mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 16:00:25 +08:00 
			
		
		
		
	请求源站错误时增加503、504错误
This commit is contained in:
		@@ -2,7 +2,6 @@ package nodes
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"github.com/iwind/TeaGo/logs"
 | 
			
		||||
	"io"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
@@ -43,8 +42,7 @@ func (this *HTTPRequest) doWebsocket() {
 | 
			
		||||
	// TODO 增加N次错误重试,重试的时候需要尝试不同的源站
 | 
			
		||||
	originConn, err := OriginConnect(this.origin, this.RawReq.RemoteAddr)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		logs.Error(err)
 | 
			
		||||
		this.write500(err)
 | 
			
		||||
		this.write50x(err, http.StatusBadGateway)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	defer func() {
 | 
			
		||||
@@ -53,15 +51,13 @@ func (this *HTTPRequest) doWebsocket() {
 | 
			
		||||
 | 
			
		||||
	err = this.RawReq.Write(originConn)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		logs.Error(err)
 | 
			
		||||
		this.write500(err)
 | 
			
		||||
		this.write50x(err, http.StatusBadGateway)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	clientConn, _, err := this.writer.Hijack()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		logs.Error(err)
 | 
			
		||||
		this.write500(err)
 | 
			
		||||
		this.write50x(err, http.StatusInternalServerError)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	defer func() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user