Fix websockets and RawUrl

pull/1010/head
Claus Vium 6 years ago
parent d6c6f3c10c
commit 5a7cca9d1b

@ -119,7 +119,7 @@ namespace Emby.Server.Implementations.SocketSharp
_cancellationTokenSource.Cancel();
// TODO
WebSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "bye", CancellationToken.None).GetAwaiter().GetResult();
// WebSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "bye", CancellationToken.None).GetAwaiter().GetResult();
}
_disposed = true;

@ -160,6 +160,15 @@ using Microsoft.Extensions.Logging;
var buffer = WebSocket.CreateClientBuffer(1024 * 4, 1024 * 4);
WebSocketReceiveResult result = await webSocketContext.ReceiveAsync(buffer, CancellationToken.None);
socket.OnReceiveBytes(buffer.Array);
while (result.MessageType != WebSocketMessageType.Close)
{
result = await webSocketContext.ReceiveAsync(buffer, CancellationToken.None);
socket.OnReceiveBytes(buffer.Array);
}
await webSocketContext.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
socket.Dispose();
//while (!result.CloseStatus.HasValue)
//{
// await webSocketContext.SendAsync(new ArraySegment<byte>(buffer, 0, result.Count), result.MessageType, result.EndOfMessage, CancellationToken.None);
@ -173,11 +182,11 @@ using Microsoft.Extensions.Logging;
// WebSocket = webSocketContext,
// Endpoint = endpoint
//});
await webSocketContext.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
//await webSocketContext.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
//SharpWebSocket socket = new SharpWebSocket(webSocketContext, _logger);
//await socket.ConnectAsServerAsync().ConfigureAwait(false);
//await ReceiveWebSocketAsync(ctx, socket).ConfigureAwait(false);
}

@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.SocketSharp
public object Dto { get; set; }
public string RawUrl => request.Path.ToString();
public string RawUrl => request.GetEncodedPathAndQuery();
public string AbsoluteUri => request.GetDisplayUrl().TrimEnd('/');

Loading…
Cancel
Save