Fix websockets and RawUrl
This commit is contained in:
parent
d6c6f3c10c
commit
5a7cca9d1b
|
@ -119,7 +119,7 @@ namespace Emby.Server.Implementations.SocketSharp
|
||||||
_cancellationTokenSource.Cancel();
|
_cancellationTokenSource.Cancel();
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
WebSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "bye", CancellationToken.None).GetAwaiter().GetResult();
|
// WebSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "bye", CancellationToken.None).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
|
|
|
@ -160,6 +160,15 @@ using Microsoft.Extensions.Logging;
|
||||||
var buffer = WebSocket.CreateClientBuffer(1024 * 4, 1024 * 4);
|
var buffer = WebSocket.CreateClientBuffer(1024 * 4, 1024 * 4);
|
||||||
WebSocketReceiveResult result = await webSocketContext.ReceiveAsync(buffer, CancellationToken.None);
|
WebSocketReceiveResult result = await webSocketContext.ReceiveAsync(buffer, CancellationToken.None);
|
||||||
socket.OnReceiveBytes(buffer.Array);
|
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)
|
//while (!result.CloseStatus.HasValue)
|
||||||
//{
|
//{
|
||||||
// await webSocketContext.SendAsync(new ArraySegment<byte>(buffer, 0, result.Count), result.MessageType, result.EndOfMessage, CancellationToken.None);
|
// 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,
|
// WebSocket = webSocketContext,
|
||||||
// Endpoint = endpoint
|
// 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);
|
//SharpWebSocket socket = new SharpWebSocket(webSocketContext, _logger);
|
||||||
//await socket.ConnectAsServerAsync().ConfigureAwait(false);
|
//await socket.ConnectAsServerAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//await ReceiveWebSocketAsync(ctx, socket).ConfigureAwait(false);
|
//await ReceiveWebSocketAsync(ctx, socket).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.SocketSharp
|
||||||
|
|
||||||
public object Dto { get; set; }
|
public object Dto { get; set; }
|
||||||
|
|
||||||
public string RawUrl => request.Path.ToString();
|
public string RawUrl => request.GetEncodedPathAndQuery();
|
||||||
|
|
||||||
public string AbsoluteUri => request.GetDisplayUrl().TrimEnd('/');
|
public string AbsoluteUri => request.GetDisplayUrl().TrimEnd('/');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user