mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
[fix] remove reWriteEncodeHeader
This commit is contained in:
parent
8adc9c87f9
commit
c3e42f2feb
3 changed files with 6 additions and 6 deletions
|
|
@ -23,7 +23,6 @@ func ChunkedProxyRequest(c *gin.Context, u string, cfg *config.Config, matcher s
|
|||
}
|
||||
setRequestHeaders(c, headReq)
|
||||
removeWSHeader(headReq) // 删除Conection Upgrade头, 避免与HTTP/2冲突(检查是否存在Upgrade头)
|
||||
reWriteEncodeHeader(headReq)
|
||||
AuthPassThrough(c, cfg, headReq)
|
||||
|
||||
headResp, err := client.Do(headReq)
|
||||
|
|
@ -65,7 +64,6 @@ func ChunkedProxyRequest(c *gin.Context, u string, cfg *config.Config, matcher s
|
|||
}
|
||||
setRequestHeaders(c, req)
|
||||
removeWSHeader(req) // 删除Conection Upgrade头, 避免与HTTP/2冲突(检查是否存在Upgrade头)
|
||||
reWriteEncodeHeader(req)
|
||||
AuthPassThrough(c, cfg, req)
|
||||
|
||||
resp, err := client.Do(req)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ func GitReq(c *gin.Context, u string, cfg *config.Config, mode string, runMode s
|
|||
}
|
||||
setRequestHeaders(c, req)
|
||||
removeWSHeader(req)
|
||||
reWriteEncodeHeader(req)
|
||||
AuthPassThrough(c, cfg, req)
|
||||
|
||||
resp, err = gitclient.Do(req)
|
||||
|
|
@ -66,7 +65,6 @@ func GitReq(c *gin.Context, u string, cfg *config.Config, mode string, runMode s
|
|||
}
|
||||
setRequestHeaders(c, req)
|
||||
removeWSHeader(req)
|
||||
reWriteEncodeHeader(req)
|
||||
AuthPassThrough(c, cfg, req)
|
||||
|
||||
resp, err = client.Do(req)
|
||||
|
|
@ -82,6 +80,10 @@ func GitReq(c *gin.Context, u string, cfg *config.Config, mode string, runMode s
|
|||
}
|
||||
}(resp.Body)
|
||||
|
||||
// 记录返回结果信息
|
||||
logDump("Resp Header: %v", resp.Header)
|
||||
logDump("Resp Status: %v", resp.StatusCode)
|
||||
|
||||
contentLength := resp.Header.Get("Content-Length")
|
||||
if contentLength != "" {
|
||||
size, err := strconv.Atoi(contentLength)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package proxy
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
|
@ -21,8 +20,8 @@ func removeWSHeader(req *http.Request) {
|
|||
req.Header.Del("Connection")
|
||||
}
|
||||
|
||||
/*
|
||||
func reWriteEncodeHeader(req *http.Request) {
|
||||
|
||||
if isGzipAccepted(req.Header) {
|
||||
req.Header.Set("Content-Encoding", "gzip")
|
||||
req.Header.Set("Accept-Encoding", "gzip")
|
||||
|
|
@ -48,3 +47,4 @@ func isGzipAccepted(header http.Header) bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue