mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
25w36d
This commit is contained in:
parent
47c03763a7
commit
ce814875e1
6 changed files with 46 additions and 8 deletions
|
|
@ -1,9 +1,15 @@
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
25w36d - 2025-05-14
|
||||||
|
---
|
||||||
|
- PRE-RELEASE: 此版本是v3.3.0预发布版本,请勿在生产环境中使用;
|
||||||
|
- ADD: 为`netpoll`模式开启探测客户端是否断开功能
|
||||||
|
|
||||||
25w36c - 2025-05-14
|
25w36c - 2025-05-14
|
||||||
---
|
---
|
||||||
- PRE-RELEASE: 此版本是v3.3.0预发布版本,请勿在生产环境中使用;
|
- PRE-RELEASE: 此版本是v3.3.0预发布版本,请勿在生产环境中使用;
|
||||||
- ADD: 加入带宽限制功能
|
- ADD: 加入带宽限制功能
|
||||||
|
- CHANGE: 将`httpc`切换回主分支, `25w36b`测试的部分已被合入`httpc`主线
|
||||||
|
|
||||||
25w36b - 2025-05-13
|
25w36b - 2025-05-13
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
25w36c
|
25w36d
|
||||||
5
main.go
5
main.go
|
|
@ -401,11 +401,13 @@ func main() {
|
||||||
r = server.New(
|
r = server.New(
|
||||||
server.WithH2C(true),
|
server.WithH2C(true),
|
||||||
server.WithHostPorts(addr),
|
server.WithHostPorts(addr),
|
||||||
|
server.WithSenseClientDisconnection(true),
|
||||||
)
|
)
|
||||||
r.AddProtocol("h2", factory.NewServerFactory())
|
r.AddProtocol("h2", factory.NewServerFactory())
|
||||||
} else {
|
} else {
|
||||||
r = server.New(
|
r = server.New(
|
||||||
server.WithHostPorts(addr),
|
server.WithHostPorts(addr),
|
||||||
|
server.WithSenseClientDisconnection(true),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -485,8 +487,7 @@ func main() {
|
||||||
defer logger.Close()
|
defer logger.Close()
|
||||||
defer func() {
|
defer func() {
|
||||||
if hertZfile != nil {
|
if hertZfile != nil {
|
||||||
var err error
|
err := hertZfile.Close()
|
||||||
err = hertZfile.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logError("Failed to close hertz log file: %v", err)
|
logError("Failed to close hertz log file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,22 @@ func ChunkedProxyRequest(ctx context.Context, c *app.RequestContext, u string, c
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
if resp != nil && resp.Body != nil {
|
||||||
|
resp.Body.Close()
|
||||||
|
}
|
||||||
|
if req != nil {
|
||||||
|
req.Body.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
rb := client.NewRequestBuilder(string(c.Request.Method()), u)
|
rb := client.NewRequestBuilder(string(c.Request.Method()), u)
|
||||||
rb.NoDefaultHeaders()
|
rb.NoDefaultHeaders()
|
||||||
rb.SetBody(c.Request.BodyStream())
|
rb.SetBody(c.Request.BodyStream())
|
||||||
rb.WithContext(ctx)
|
rb.WithContext(ctx)
|
||||||
|
|
||||||
req, err = rb.Build()
|
req, err = rb.Build()
|
||||||
//req, err = client.NewRequest(string(method), u, c.Request.BodyStream())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
HandleError(c, fmt.Sprintf("Failed to create request: %v", err))
|
HandleError(c, fmt.Sprintf("Failed to create request: %v", err))
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,16 @@ func GhcrRequest(ctx context.Context, c *app.RequestContext, u string, cfg *conf
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
if resp != nil && resp.Body != nil {
|
||||||
|
resp.Body.Close()
|
||||||
|
}
|
||||||
|
if req != nil {
|
||||||
|
req.Body.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
method = c.Request.Method()
|
method = c.Request.Method()
|
||||||
|
|
||||||
rb := client.NewRequestBuilder(string(method), u)
|
rb := client.NewRequestBuilder(string(method), u)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,22 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func GitReq(ctx context.Context, c *app.RequestContext, u string, cfg *config.Config, mode string) {
|
func GitReq(ctx context.Context, c *app.RequestContext, u string, cfg *config.Config, mode string) {
|
||||||
|
|
||||||
|
var (
|
||||||
|
req *http.Request
|
||||||
|
resp *http.Response
|
||||||
|
)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
if resp != nil && resp.Body != nil {
|
||||||
|
resp.Body.Close()
|
||||||
|
}
|
||||||
|
if req != nil {
|
||||||
|
req.Body.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
method := string(c.Request.Method())
|
method := string(c.Request.Method())
|
||||||
|
|
||||||
reqBodyReader := bytes.NewBuffer(c.Request.Body())
|
reqBodyReader := bytes.NewBuffer(c.Request.Body())
|
||||||
|
|
@ -29,10 +45,6 @@ func GitReq(ctx context.Context, c *app.RequestContext, u string, cfg *config.Co
|
||||||
u = cfg.GitClone.SmartGitAddr + userPath + repoPath + remainingPath + "?" + queryParams.Encode()
|
u = cfg.GitClone.SmartGitAddr + userPath + repoPath + remainingPath + "?" + queryParams.Encode()
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
resp *http.Response
|
|
||||||
)
|
|
||||||
|
|
||||||
if cfg.GitClone.Mode == "cache" {
|
if cfg.GitClone.Mode == "cache" {
|
||||||
rb := gitclient.NewRequestBuilder(method, u)
|
rb := gitclient.NewRequestBuilder(method, u)
|
||||||
rb.NoDefaultHeaders()
|
rb.NoDefaultHeaders()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue