diff options
| author | Claus Vium <clausvium@gmail.com> | 2019-03-03 13:54:14 +0100 |
|---|---|---|
| committer | Claus Vium <clausvium@gmail.com> | 2019-03-03 13:54:14 +0100 |
| commit | 1cc433eabc4813fd175b8ce63b27490663cbbcee (patch) | |
| tree | 1648cca260cba4498eefe1a3672bf82fd31c50a4 /Emby.Server.Implementations/SocketSharp | |
| parent | d450169964680ed249f140de8422bf415b44958c (diff) | |
Start the webhost before RunStartupTasks and fix ContentEncoding
Diffstat (limited to 'Emby.Server.Implementations/SocketSharp')
| -rw-r--r-- | Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs b/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs index 24fd36062..976f2ec06 100644 --- a/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs +++ b/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs @@ -408,11 +408,28 @@ namespace Emby.Server.Implementations.SocketSharp public string ContentType => request.ContentType; - private Encoding contentEncoding; - public Encoding ContentEncoding + private Encoding ContentEncoding { - get => contentEncoding ?? Encoding.GetEncoding(request.Headers[HeaderNames.ContentEncoding].ToString()); - set => contentEncoding = value; + get + { + // TODO is this necessary? + if (UserAgent != null && CultureInfo.InvariantCulture.CompareInfo.IsPrefix(UserAgent, "UP")) + { + string postDataCharset = Headers["x-up-devcap-post-charset"]; + if (!string.IsNullOrEmpty(postDataCharset)) + { + try + { + return Encoding.GetEncoding(postDataCharset); + } + catch (ArgumentException) + { + } + } + } + + return request.GetTypedHeaders().ContentType.Encoding ?? Encoding.UTF8; + } } public Uri UrlReferrer => request.GetTypedHeaders().Referer; |
