Selaa lähdekoodia

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.
Xiaokang Wang (Shelikhoo) 2 vuotta sitten
vanhempi
sitoutus
b54da9c6af
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      transport/v2raywebsocket/client.go

+ 4 - 0
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