mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-12-01 12:16:50 +00:00
fix: convert emit HTTP2Options-shaped h2-opts for share-link HTTP/2 transport (#2737)
This commit is contained in:
1 parent
8d5395283d
commit
f5cfb8d26b
2 files changed
+4
-7
No files matched your search
@@ -172,9 +172,8 @@ func TestConvertsV2RayVlessHTTPTransportUsesH2Opts(t *testing.T) {
|
||||
assert.Len(t, proxies, 1)
|
||||
assert.Equal(t, "h2", proxies[0]["network"])
|
||||
assert.Equal(t, map[string]any{
|
||||
"host": []string{"cdn.example.com"},
|
||||
"path": []string{"/grpc"},
|
||||
"headers": map[string]any{},
|
||||
"host": []string{"cdn.example.com"},
|
||||
"path": "/grpc",
|
||||
}, proxies[0]["h2-opts"])
|
||||
assert.NotContains(t, proxies[0], "http-opts")
|
||||
}
|
||||
+2
-4
@@ -91,16 +91,14 @@ func handleVShareLink(names map[string]int, url *url.URL, scheme string, proxy m
|
||||
proxy["http-opts"] = httpOpts
|
||||
|
||||
case "h2":
|
||||
headers := make(map[string]any)
|
||||
h2Opts := make(map[string]any)
|
||||
h2Opts["path"] = []string{"/"}
|
||||
h2Opts["path"] = "/"
|
||||
if path := query.Get("path"); path != "" {
|
||||
h2Opts["path"] = []string{path}
|
||||
h2Opts["path"] = path
|
||||
}
|
||||
if host := query.Get("host"); host != "" {
|
||||
h2Opts["host"] = []string{host}
|
||||
}
|
||||
h2Opts["headers"] = headers
|
||||
proxy["h2-opts"] = h2Opts
|
||||
|
||||
case "ws", "httpupgrade":
|
||||
|
||||
Reference in new issue
Block a user