Seems that EmbedIO 1.9+ for .NET Core 2 started using default sockets instead of Unosquare.Net. But when I trying to connect by websocket to demo server from readme page from Firefox context.Request.IsWebSocketRequest is always false. Although in Chrome this works.
Tested in both Linux and Windows. Version for .NET 4.6 with Unosquare.Net works well.
Ok, let me take a look
I was able to reproduce the issue, checking System.Net.HttpListenerRequest source code at https://github.com/dotnet/corefx/blob/master/src/System.Net.HttpListener/src/System/Net/HttpListenerRequest.cs#L116
Firefox is sending two values in the Connection Header "keep-alive, Upgrade" meanwhile Chrome just "Upgrade". Checking the source code from Microsoft, I found that GetValues method (NameValueCollection class) is returning one single item when it should return two. That's why the "Upgrade" connection operation is not found.
I tested the NameValueCollection class apart, and it's working fine with NET Core 2.0:
var coll = new System.Collections.Specialized.NameValueCollection();
coll.Add("Connection", "keep-alive");
coll.Add("Connection", "Upgrade");
foreach (var connection in coll.GetValues("Connection"))
Console.WriteLine(connection);
So I guess the issue is when the HttpListener is creating the request object and populating the Header collection...
Here is where the Headers are created: https://github.com/dotnet/corefx/blob/master/src/Common/src/Interop/Windows/HttpApi/Interop.HttpApi.cs#L799
This is really out of scope from EmbedIO...
Ok, thanks. Going to open issue for corefx
Hi @alhimik45 did you report the issue?
@geoperez Yes, https://github.com/dotnet/corefx/issues/24550
@alhimik45 maybe applying this workaround (https://github.com/dotnet/corefx/issues/24550#issuecomment-338048691).
I'm going to check if I can attached to current request handler.
@alhimik45 can you try version 1.11.3?
@geoperez Yep, Firefox works now. Thanks!