From 13bc0432bcc9313a00bae0e9e8a8aa163f6d9b26 Mon Sep 17 00:00:00 2001 From: Xiaokang Wang Date: Fri, 22 Oct 2021 05:08:50 +0100 Subject: [PATCH] WebSocket Early Data Protocol Harmonization with V2Ray/V2Fly (#548) * protocol harmonization with V2Ray/V2Fly by supporting both V2Ray server and XRay server * protocol harmonization with V2Ray/V2Fly by supporting both V2Ray server and XRay server comment --- transport/internet/websocket/dialer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/transport/internet/websocket/dialer.go b/transport/internet/websocket/dialer.go index 67f159b1..6a06a67e 100644 --- a/transport/internet/websocket/dialer.go +++ b/transport/internet/websocket/dialer.go @@ -120,7 +120,8 @@ func dialWebSocket(ctx context.Context, dest net.Destination, streamSettings *in header := wsSettings.GetRequestHeader() if ed != nil { - header.Set("Sec-WebSocket-Protocol", base64.StdEncoding.EncodeToString(ed)) + // RawURLEncoding is support by both V2Ray/V2Fly and XRay. + header.Set("Sec-WebSocket-Protocol", base64.RawURLEncoding.EncodeToString(ed)) } conn, resp, err := dialer.Dial(uri, header)