From 93521963b17a5a8d158a0a95e0b4583f06d3cda1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Thu, 10 Aug 2023 14:02:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=94=AF=E6=8C=81=E4=BD=8E?= =?UTF-8?q?=E7=89=88=E6=9C=ACHTTP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_reverse_proxy.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/internal/nodes/http_request_reverse_proxy.go b/internal/nodes/http_request_reverse_proxy.go index 2d8008e..c104469 100644 --- a/internal/nodes/http_request_reverse_proxy.go +++ b/internal/nodes/http_request_reverse_proxy.go @@ -21,15 +21,13 @@ func (this *HTTPRequest) doReverseProxy() { return } - var isLowVersionHTTP = this.RawReq.ProtoMajor < 1 /** 0.x **/ || (this.RawReq.ProtoMajor == 1 && this.RawReq.ProtoMinor == 0 /** 1.0 **/) - var retries = 3 var failedOriginIds []int64 var failedLnNodeIds []int64 for i := 0; i < retries; i++ { - originId, lnNodeId, shouldRetry := this.doOriginRequest(failedOriginIds, failedLnNodeIds, i == 0, i == retries-1, isLowVersionHTTP) + originId, lnNodeId, shouldRetry := this.doOriginRequest(failedOriginIds, failedLnNodeIds, i == 0, i == retries-1) if !shouldRetry { break } @@ -43,7 +41,7 @@ func (this *HTTPRequest) doReverseProxy() { } // 请求源站 -func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeIds []int64, isFirstTry bool, isLastRetry bool, isLowVersionHTTP bool) (originId int64, lnNodeId int64, shouldRetry bool) { +func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeIds []int64, isFirstTry bool, isLastRetry bool) (originId int64, lnNodeId int64, shouldRetry bool) { // 对URL的处理 var stripPrefix = this.reverseProxy.StripPrefix var requestURI = this.reverseProxy.RequestURI @@ -375,13 +373,6 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId return } - // 是否为1.1以下 - if isLowVersionHTTP && resp.ContentLength < 0 { - this.writer.WriteHeader(http.StatusBadRequest) - _, _ = this.writer.WriteString("The content does not support " + this.RawReq.Proto + " request.") - return - } - // 记录相关数据 this.originStatus = int32(resp.StatusCode)