This commit is contained in:
wjqserver 2025-06-14 06:51:41 +08:00
parent d2a0177015
commit bd8412f157
2 changed files with 11 additions and 10 deletions

View file

@ -1 +1 @@
25w46a
25w46b

View file

@ -1,7 +1,6 @@
package proxy
import (
"bytes"
"context"
"fmt"
"ghproxy/config"
@ -33,8 +32,8 @@ func ChunkedProxyRequest(ctx context.Context, c *app.RequestContext, u string, c
rb := client.NewRequestBuilder(string(c.Request.Method()), u)
rb.NoDefaultHeaders()
rb.SetBody(bytes.NewBuffer(c.Request.Body()))
//rb.SetBody(c.RequestBodyStream())
//rb.SetBody(bytes.NewBuffer(c.Request.Body()))
rb.SetBody(c.RequestBodyStream())
rb.WithContext(ctx)
req, err = rb.Build()
@ -112,12 +111,14 @@ func ChunkedProxyRequest(ctx context.Context, c *app.RequestContext, u string, c
bodyReader = limitreader.NewRateLimitedReader(bodyReader, bandwidthLimit, int(bandwidthBurst), ctx)
}
/*
defer func() {
err := bodyReader.Close()
if err != nil {
logError("Failed to close response body: %v", err)
}
}()
*/
if MatcherShell(u) && matchString(matcher) && cfg.Shell.Editor {
// 判断body是不是gzip