Yucked/Rhapsody

403 on attempted server connection

Neuheit opened this issue · 2 comments

When trying to connect using a ClientWebSocket, I get a 403. I believe this is before it checks authorization as well.

Code:

static async Task MainAsync()
{
     ClientWebSocket socket = new ClientWebSocket();

     socket.Options.SetRequestHeader("Authorization", "Conceptual");

     await socket.ConnectAsync(new Uri("ws://localhost:6969"), CancellationToken.None);

     await Task.Delay(-1);  
}

Concept Log:

[Oct 10 - 01:50:07 PM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Connection id "0HLQDL94UIBPN" accepted.
[Oct 10 - 01:50:07 PM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Connection id "0HLQDL94UIBPN" started.
[Oct 10 - 01:50:07 PM] [INFO] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Request starting HTTP/1.1 GET http://localhost:6969/
[Oct 10 - 01:50:07 PM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Wildcard detected, all requests with hosts will be allowed.
[Oct 10 - 01:50:07 PM] [TRCE] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> All hosts are allowed.
[Oct 10 - 01:50:07 PM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> No candidates found for the request path '/'
[Oct 10 - 01:50:07 PM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Request did not match any endpoints
[Oct 10 - 01:50:07 PM] [INFO] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Request finished in 39.1236ms 403
            _clientSock = new ClientSock(new Endpoint("127.0.0.1", 6969, false));
            _clientSock.AddHeader("User-Id", "203709726322720768");
            _clientSock.AddHeader("Authorization", "Conceptual");

Missing a User-Id header.

[Oct 10 - 11:10:00 AM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Connection id "0HLQDLK8GOJF5" accepted.
[Oct 10 - 11:10:00 AM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Connection id "0HLQDLK8GOJF5" started.
[Oct 10 - 11:10:01 AM] [INFO] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Request starting HTTP/1.1 GET http://127.0.0.1:6969/
[Oct 10 - 11:10:01 AM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Wildcard detected, all requests with hosts will be allowed.
[Oct 10 - 11:10:01 AM] [TRCE] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> All hosts are allowed.
[Oct 10 - 11:10:01 AM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> No candidates found for the request path '/'
[Oct 10 - 11:10:01 AM] [DBUG] [Microsoft.Extensions.Hosting.Internal.ApplicationLifetime]
  -> Request did not match any endpoints
[Oct 10 - 11:10:01 AM] [INFO] [Concept.Middlewares.WebSocketMiddleware]
  -> Incoming websocket request from 127.0.0.1:62408.
[Oct 10 - 11:10:01 AM] [INFO] [Concept.Middlewares.WebSocketMiddleware]
  -> User with 203709726322720768 snowflake connected!

That fixed it, thanks