mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-06-13 23:57:37 +08:00
perf(proxy): optimize hot request paths
- Cache route handlers, simplify NoRoute path normalization, and reduce matcher/header allocations - Honor configured transport pool limits in auto mode and add hotpath regression benchmarks/tests
This commit is contained in:
parent
e2719aa761
commit
ba3dcf7624
9 changed files with 437 additions and 51 deletions
|
|
@ -99,12 +99,24 @@ func TestMatcher_Compatibility(t *testing.T) {
|
|||
config: cfgWithAuth,
|
||||
expectedUser: "owner", expectedRepo: "repo", expectedMatcher: "raw",
|
||||
},
|
||||
{
|
||||
name: "Malformed Raw Path (missing branch)",
|
||||
rawPath: "https://raw.githubusercontent.com/owner/repo",
|
||||
config: cfgWithAuth,
|
||||
expectError: true, expectedErrCode: 400,
|
||||
},
|
||||
{
|
||||
name: "Gist Path",
|
||||
rawPath: "https://gist.github.com/user/abcdef1234567890",
|
||||
config: cfgWithAuth,
|
||||
expectedUser: "user", expectedRepo: "", expectedMatcher: "gist",
|
||||
},
|
||||
{
|
||||
name: "Gist Path (user only)",
|
||||
rawPath: "https://gist.github.com/user",
|
||||
config: cfgWithAuth,
|
||||
expectedUser: "user", expectedRepo: "", expectedMatcher: "gist",
|
||||
},
|
||||
{
|
||||
name: "Gist UserContent Path",
|
||||
rawPath: "https://gist.githubusercontent.com/user/abcdef1234567890",
|
||||
|
|
@ -135,6 +147,18 @@ func TestMatcher_Compatibility(t *testing.T) {
|
|||
config: cfgApiForceAllowed, // Auth disabled, but force allowed
|
||||
expectedUser: "owner", expectedRepo: "repo", expectedMatcher: "api",
|
||||
},
|
||||
{
|
||||
name: "API Repos Path (missing repo)",
|
||||
rawPath: "https://api.github.com/repos/owner",
|
||||
config: cfgWithAuth,
|
||||
expectedUser: "", expectedRepo: "", expectedMatcher: "api",
|
||||
},
|
||||
{
|
||||
name: "API Users Path (exact user)",
|
||||
rawPath: "https://api.github.com/users/someuser",
|
||||
config: cfgWithAuth,
|
||||
expectedUser: "someuser", expectedRepo: "", expectedMatcher: "api",
|
||||
},
|
||||
{
|
||||
name: "Malformed GH Path (no repo)",
|
||||
rawPath: "https://github.com/owner/",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue