Hello, i found issue with cookies. When using WebSocketModule, response returns Set-Cookie header with all request cookies joined into one cookie. NameValueCollection in WebSocketHandshakeResponse joins all the values under the same key via comma separator, which causes confusing result in response headers, like
This problem occurs only when Embedio built with WebSocketModule.
Perhaps, the problem is in line 26 in unexpected NameValueCollection.Add method behavior.
And WebSocketHandshakeResponse.cs, line 45 returns that merged cookie string.
Steps to reproduce the behavior:
Run Embedio with WebSocketModule
A. (UWP) Set cookies for Microsoft.Web.WebView2.Core.CoreWebView2 via
CoreWebView2 .CoreWebView2.CookieManager.AddOrUpdateCookie(cookie);
B. (Android) Set cookies for Android.Webkit.WebView via
CookieManager.Instance.SetAcceptCookie(true);
CookieManager.Instance.SetAcceptThirdPartyCookies(webView, true);
CookieManager.Instance.SetCookie(cookie);
Try to connect to the webocket
Check response cookies via DevTools
Expected behavior should be:
Set-Cookie: en=culture
Set-Cookie: token=...
Desktop
Windows 10 Pro 22H2,
Browser Microsoft.Web.WebView2.Core.CoreWebView2
Version [Latest update]
Smartphone:
Device: Samsung SM-P613,
OS: Android 13
Browser Android.Webkit.WebView
Version [Latest update]
And additional question, for which purpose do we set cookies back to the client at WebSocketHandshakeResponse, line 43? Do we need that?
Hello, i found issue with cookies. When using WebSocketModule, response returns Set-Cookie header with all request cookies joined into one cookie. NameValueCollection in WebSocketHandshakeResponse joins all the values under the same key via comma separator, which causes confusing result in response headers, like![image](https://github.com/unosquare/embedio/assets/122959758/6ff40c12-9909-4cb8-9b37-2bb2788b7e5e)
This problem occurs only when Embedio built with WebSocketModule. Perhaps, the problem is in line 26 in unexpected NameValueCollection.Add method behavior.
![image](https://github.com/unosquare/embedio/assets/122959758/2c8991d7-d9f4-4e6d-85b6-10379290514b)
And WebSocketHandshakeResponse.cs, line 45 returns that merged cookie string.![image](https://github.com/unosquare/embedio/assets/122959758/7c494393-7e97-4e06-a055-f643bd9a25b4)
Steps to reproduce the behavior:
A. (UWP) Set cookies for Microsoft.Web.WebView2.Core.CoreWebView2 via CoreWebView2 .CoreWebView2.CookieManager.AddOrUpdateCookie(cookie); B. (Android) Set cookies for Android.Webkit.WebView via CookieManager.Instance.SetAcceptCookie(true); CookieManager.Instance.SetAcceptThirdPartyCookies(webView, true); CookieManager.Instance.SetCookie(cookie);
Expected behavior should be:
Set-Cookie: en=culture Set-Cookie: token=...
Desktop
Smartphone:
Version [Latest update]
And additional question, for which purpose do we set cookies back to the client at WebSocketHandshakeResponse, line 43? Do we need that?