diff options
| author | Vasily <JustAMan@users.noreply.github.com> | 2019-03-08 00:23:00 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-08 00:23:00 +0300 |
| commit | 028a98d2c1440ba25e50e54ae97e81c55bc4c497 (patch) | |
| tree | d10e832cb29d4dce888f18e68eb8bb99c426892b /Emby.Server.Implementations/SocketSharp/RequestMono.cs | |
| parent | 0f70a81db3d2d94dc50a407ba39963fd5df6d01f (diff) | |
| parent | c5fce647defd2eace2d2431ccc52ffe1d027c184 (diff) | |
Merge pull request #1058 from Bond-009/clean
Cleanup/simplification
Diffstat (limited to 'Emby.Server.Implementations/SocketSharp/RequestMono.cs')
| -rw-r--r-- | Emby.Server.Implementations/SocketSharp/RequestMono.cs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/SocketSharp/RequestMono.cs b/Emby.Server.Implementations/SocketSharp/RequestMono.cs index 5e29e4058..373f6d758 100644 --- a/Emby.Server.Implementations/SocketSharp/RequestMono.cs +++ b/Emby.Server.Implementations/SocketSharp/RequestMono.cs @@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.SocketSharp byte[] copy = new byte[e.Length]; input.Position = e.Start; - input.Read(copy, 0, (int)e.Length); + await input.ReadAsync(copy, 0, (int)e.Length).ConfigureAwait(false); form.Add(e.Name, (e.Encoding ?? ContentEncoding).GetString(copy, 0, copy.Length)); } @@ -98,11 +98,11 @@ namespace Emby.Server.Implementations.SocketSharp var form = new WebROCollection(); files = new Dictionary<string, HttpPostedFile>(); - if (IsContentType("multipart/form-data", true)) + if (IsContentType("multipart/form-data")) { await LoadMultiPart(form).ConfigureAwait(false); } - else if (IsContentType("application/x-www-form-urlencoded", true)) + else if (IsContentType("application/x-www-form-urlencoded")) { await LoadWwwForm(form).ConfigureAwait(false); } @@ -200,19 +200,14 @@ namespace Emby.Server.Implementations.SocketSharp return false; } - private bool IsContentType(string ct, bool starts_with) + private bool IsContentType(string ct) { - if (ct == null || ContentType == null) + if (ContentType == null) { return false; } - if (starts_with) - { - return ContentType.StartsWith(ct, StringComparison.OrdinalIgnoreCase); - } - - return string.Equals(ContentType, ct, StringComparison.OrdinalIgnoreCase); + return ContentType.StartsWith(ct, StringComparison.OrdinalIgnoreCase); } private async Task LoadWwwForm(WebROCollection form) |
