diff options
| author | cvium <clausvium@gmail.com> | 2019-01-16 20:50:40 +0100 |
|---|---|---|
| committer | Claus Vium <clausvium@gmail.com> | 2019-01-20 06:30:50 +0100 |
| commit | b35dcbb9f02c27d2d84ee3281a60d654a3fb1259 (patch) | |
| tree | 12049e17ac9e6cdbe2e7fec5ec7a886cff8a8c6d /Emby.Server.Implementations/HttpServer | |
| parent | 3a5e3ade01ab4b4fccca03ba2da969f03d5564f1 (diff) | |
Remove MediaBrowser.Text since it violates licenses and is overall hacky
Diffstat (limited to 'Emby.Server.Implementations/HttpServer')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/HttpListenerHost.cs | 9 | ||||
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/WebSocketConnection.cs | 17 |
2 files changed, 8 insertions, 18 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 033ffd4c0..7dfe029f8 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -19,7 +19,6 @@ using MediaBrowser.Model.Events; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Services; -using MediaBrowser.Model.Text; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.HttpServer @@ -37,11 +36,7 @@ namespace Emby.Server.Implementations.HttpServer private readonly IServerConfigurationManager _config; private readonly INetworkManager _networkManager; - private readonly IServerApplicationHost _appHost; - - private readonly ITextEncoding _textEncoding; - private readonly IJsonSerializer _jsonSerializer; private readonly IXmlSerializer _xmlSerializer; private readonly Func<Type, Func<string, object>> _funcParseFn; @@ -60,7 +55,6 @@ namespace Emby.Server.Implementations.HttpServer IServerConfigurationManager config, string defaultRedirectPath, INetworkManager networkManager, - ITextEncoding textEncoding, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, Func<Type, Func<string, object>> funcParseFn) @@ -70,7 +64,6 @@ namespace Emby.Server.Implementations.HttpServer _config = config; DefaultRedirectPath = defaultRedirectPath; _networkManager = networkManager; - _textEncoding = textEncoding; _jsonSerializer = jsonSerializer; _xmlSerializer = xmlSerializer; _funcParseFn = funcParseFn; @@ -147,7 +140,7 @@ namespace Emby.Server.Implementations.HttpServer return; } - var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, _jsonSerializer, _logger, _textEncoding) + var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, _jsonSerializer, _logger) { OnReceive = ProcessWebSocketMessageReceived, Url = e.Url, diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs index b9146d007..e9d0bac74 100644 --- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs +++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net.WebSockets; using System.Text; using System.Threading; @@ -8,8 +8,8 @@ using MediaBrowser.Controller.Net; using MediaBrowser.Model.Net; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Services; -using MediaBrowser.Model.Text; using Microsoft.Extensions.Logging; +using UtfUnknown; namespace Emby.Server.Implementations.HttpServer { @@ -68,7 +68,6 @@ namespace Emby.Server.Implementations.HttpServer /// </summary> /// <value>The query string.</value> public QueryParamCollection QueryString { get; set; } - private readonly ITextEncoding _textEncoding; /// <summary> /// Initializes a new instance of the <see cref="WebSocketConnection" /> class. @@ -78,7 +77,7 @@ namespace Emby.Server.Implementations.HttpServer /// <param name="jsonSerializer">The json serializer.</param> /// <param name="logger">The logger.</param> /// <exception cref="ArgumentNullException">socket</exception> - public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger, ITextEncoding textEncoding) + public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger) { if (socket == null) { @@ -110,7 +109,6 @@ namespace Emby.Server.Implementations.HttpServer RemoteEndPoint = remoteEndPoint; _logger = logger; - _textEncoding = textEncoding; socket.Closed += socket_Closed; } @@ -132,8 +130,7 @@ namespace Emby.Server.Implementations.HttpServer { return; } - - var charset = _textEncoding.GetDetectedEncodingName(bytes, bytes.Length, null, false); + var charset = CharsetDetector.DetectFromBytes(bytes).Detected?.EncodingName; if (string.Equals(charset, "utf-8", StringComparison.OrdinalIgnoreCase)) { @@ -141,7 +138,7 @@ namespace Emby.Server.Implementations.HttpServer } else { - OnReceiveInternal(_textEncoding.GetASCIIEncoding().GetString(bytes, 0, bytes.Length)); + OnReceiveInternal(Encoding.ASCII.GetString(bytes, 0, bytes.Length)); } } @@ -161,7 +158,7 @@ namespace Emby.Server.Implementations.HttpServer var bytes = memory.Slice(0, length).ToArray(); - var charset = _textEncoding.GetDetectedEncodingName(bytes, bytes.Length, null, false); + var charset = CharsetDetector.DetectFromBytes(bytes).Detected?.EncodingName; if (string.Equals(charset, "utf-8", StringComparison.OrdinalIgnoreCase)) { @@ -169,7 +166,7 @@ namespace Emby.Server.Implementations.HttpServer } else { - OnReceiveInternal(_textEncoding.GetASCIIEncoding().GetString(bytes, 0, bytes.Length)); + OnReceiveInternal(Encoding.ASCII.GetString(bytes, 0, bytes.Length)); } } |
