Merge pull request #83 from WJQSERVER-STUDIO/main

Sync to v2 Branch
This commit is contained in:
WJQSERVER 2025-03-30 17:42:52 +08:00 committed by GitHub
commit 36779f82f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 22 additions and 8 deletions

View file

@ -1,5 +1,19 @@
# 更新日志 # 更新日志
2.6.3 - 2025-03-30
---
- FIX: 修正一些`git clone`行为异常
25w25a - 2025-03-30
---
- PRE-RELEASE: 此版本是v2.6.3的预发布版本,请勿在生产环境中使用;
- FIX: 修正一些`git clone`行为异常
e3.0.7 - 2025-03-29
---
- CHANGE: 将`cfg`flag改为`c`以符合`POSIX`规范
- CHANGE: 为`smart-git`添加`no-cache`标头
2.6.2 - 2025-03-29 2.6.2 - 2025-03-29
--- ---
- BACKPORT: 反向移植前端资源加载改进 - BACKPORT: 反向移植前端资源加载改进

View file

@ -1 +1 @@
25w24a 25w25a

View file

@ -1 +1 @@
2.6.2 2.6.3

View file

@ -23,7 +23,6 @@ func ChunkedProxyRequest(c *gin.Context, u string, cfg *config.Config, matcher s
} }
setRequestHeaders(c, headReq) setRequestHeaders(c, headReq)
removeWSHeader(headReq) // 删除Conection Upgrade头, 避免与HTTP/2冲突(检查是否存在Upgrade头) removeWSHeader(headReq) // 删除Conection Upgrade头, 避免与HTTP/2冲突(检查是否存在Upgrade头)
reWriteEncodeHeader(headReq)
AuthPassThrough(c, cfg, headReq) AuthPassThrough(c, cfg, headReq)
headResp, err := client.Do(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) setRequestHeaders(c, req)
removeWSHeader(req) // 删除Conection Upgrade头, 避免与HTTP/2冲突(检查是否存在Upgrade头) removeWSHeader(req) // 删除Conection Upgrade头, 避免与HTTP/2冲突(检查是否存在Upgrade头)
reWriteEncodeHeader(req)
AuthPassThrough(c, cfg, req) AuthPassThrough(c, cfg, req)
resp, err := client.Do(req) resp, err := client.Do(req)

View file

@ -50,7 +50,6 @@ func GitReq(c *gin.Context, u string, cfg *config.Config, mode string, runMode s
} }
setRequestHeaders(c, req) setRequestHeaders(c, req)
removeWSHeader(req) removeWSHeader(req)
reWriteEncodeHeader(req)
AuthPassThrough(c, cfg, req) AuthPassThrough(c, cfg, req)
resp, err = gitclient.Do(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) setRequestHeaders(c, req)
removeWSHeader(req) removeWSHeader(req)
reWriteEncodeHeader(req)
AuthPassThrough(c, cfg, req) AuthPassThrough(c, cfg, req)
resp, err = client.Do(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) }(resp.Body)
// 记录返回结果信息
logDump("Resp Header: %v", resp.Header)
logDump("Resp Status: %v", resp.StatusCode)
contentLength := resp.Header.Get("Content-Length") contentLength := resp.Header.Get("Content-Length")
if contentLength != "" { if contentLength != "" {
size, err := strconv.Atoi(contentLength) size, err := strconv.Atoi(contentLength)

View file

@ -2,7 +2,6 @@ package proxy
import ( import (
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -21,8 +20,8 @@ func removeWSHeader(req *http.Request) {
req.Header.Del("Connection") req.Header.Del("Connection")
} }
/*
func reWriteEncodeHeader(req *http.Request) { func reWriteEncodeHeader(req *http.Request) {
if isGzipAccepted(req.Header) { if isGzipAccepted(req.Header) {
req.Header.Set("Content-Encoding", "gzip") req.Header.Set("Content-Encoding", "gzip")
req.Header.Set("Accept-Encoding", "gzip") req.Header.Set("Accept-Encoding", "gzip")
@ -48,3 +47,4 @@ func isGzipAccepted(header http.Header) bool {
} }
return false return false
} }
*/