mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-06-13 23:57:37 +08:00
perf(proxy): reduce nest rewrite allocations
- Dispatch shell link rewriting between streaming and buffered paths based on response size - Reuse buffers and reduce URL construction allocations in proxy handlers - Add nest benchmarks and align extractParts compatibility expectations with the current contract
This commit is contained in:
parent
4c555ed50c
commit
e2719aa761
6 changed files with 248 additions and 88 deletions
|
|
@ -74,7 +74,7 @@ func ChunkedProxyRequest(ctx context.Context, c *touka.Context, u string, cfg *c
|
|||
// 处理响应体大小限制
|
||||
|
||||
var (
|
||||
bodySize int
|
||||
bodySize = -1
|
||||
contentLength string
|
||||
sizelimit int
|
||||
)
|
||||
|
|
@ -134,7 +134,7 @@ func ChunkedProxyRequest(ctx context.Context, c *touka.Context, u string, cfg *c
|
|||
|
||||
var reader io.Reader
|
||||
|
||||
reader, _, err = processLinks(bodyReader, c.Request.Host, cfg, c)
|
||||
reader, _, err = processLinks(bodyReader, c.Request.Host, cfg, c, bodySize)
|
||||
c.WriteStream(reader)
|
||||
if err != nil {
|
||||
c.Errorf("%s %s %s %s %s Failed to copy response body: %v", c.ClientIP(), c.Request.Method, u, c.UserAgent(), c.Request.Proto, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue