From b54da9c6af2c65b26d801dd32c3c5a08a597a9e1 Mon Sep 17 00:00:00 2001 From: "Xiaokang Wang (Shelikhoo)" Date: Wed, 12 Apr 2023 00:25:27 +0100 Subject: [PATCH] Fix '?' at end of WebSocket path get escaped This fix align sing-box's behaviour with V2Ray when it comes to processing ? at the end of WebSocket's path. --- transport/v2raywebsocket/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/transport/v2raywebsocket/client.go b/transport/v2raywebsocket/client.go index 49d7555a..be766b76 100644 --- a/transport/v2raywebsocket/client.go +++ b/transport/v2raywebsocket/client.go @@ -60,6 +60,10 @@ func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, opt if !strings.HasPrefix(uri.Path, "/") { uri.Path = "/" + uri.Path } + if strings.HasSuffix(uri.Path, "?") { + uri.ForceQuery = true + uri.Path = strings.TrimSuffix(uri.Path, "?") + } headers := make(http.Header) for key, value := range options.Headers { headers[key] = value