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.
This commit is contained in:
Xiaokang Wang (Shelikhoo) 2023-04-12 00:25:27 +01:00 committed by 世界
parent a548e45ad7
commit 84bd997742
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -61,6 +61,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