From f5cfb8d26b4b1b96f0ebc8d1aed94e2672847ea3 Mon Sep 17 00:00:00 2001 From: wangwei354 Date: Wed, 22 Apr 2026 19:28:33 +0800 Subject: [PATCH] fix: convert emit HTTP2Options-shaped h2-opts for share-link HTTP/2 transport (#2737) --- common/convert/converter_test.go | 5 ++--- common/convert/v.go | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/common/convert/converter_test.go b/common/convert/converter_test.go index bee4d5dc0..31ed168e6 100644 --- a/common/convert/converter_test.go +++ b/common/convert/converter_test.go @@ -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") } diff --git a/common/convert/v.go b/common/convert/v.go index d6603f06b..9ba6d1f47 100644 --- a/common/convert/v.go +++ b/common/convert/v.go @@ -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":