mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
25w46b
This commit is contained in:
parent
d2a0177015
commit
bd8412f157
2 changed files with 11 additions and 10 deletions
|
|
@ -1 +1 @@
|
||||||
25w46a
|
25w46b
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package proxy
|
package proxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"ghproxy/config"
|
"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 := client.NewRequestBuilder(string(c.Request.Method()), u)
|
||||||
rb.NoDefaultHeaders()
|
rb.NoDefaultHeaders()
|
||||||
rb.SetBody(bytes.NewBuffer(c.Request.Body()))
|
//rb.SetBody(bytes.NewBuffer(c.Request.Body()))
|
||||||
//rb.SetBody(c.RequestBodyStream())
|
rb.SetBody(c.RequestBodyStream())
|
||||||
rb.WithContext(ctx)
|
rb.WithContext(ctx)
|
||||||
|
|
||||||
req, err = rb.Build()
|
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)
|
bodyReader = limitreader.NewRateLimitedReader(bodyReader, bandwidthLimit, int(bandwidthBurst), ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
/*
|
||||||
err := bodyReader.Close()
|
defer func() {
|
||||||
if err != nil {
|
err := bodyReader.Close()
|
||||||
logError("Failed to close response body: %v", err)
|
if err != nil {
|
||||||
}
|
logError("Failed to close response body: %v", err)
|
||||||
}()
|
}
|
||||||
|
}()
|
||||||
|
*/
|
||||||
|
|
||||||
if MatcherShell(u) && matchString(matcher) && cfg.Shell.Editor {
|
if MatcherShell(u) && matchString(matcher) && cfg.Shell.Editor {
|
||||||
// 判断body是不是gzip
|
// 判断body是不是gzip
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue