diff options
| author | Anthony Lavado <anthonylavado@users.noreply.github.com> | 2019-06-14 09:19:56 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-14 09:19:56 -0400 |
| commit | d4a42a1680a48cba0d87fac0808180e68072baab (patch) | |
| tree | 0969864c31878d1146e48167dc7a6bba70187266 /Emby.Server.Implementations/ApplicationHost.cs | |
| parent | b25c08e79ae56fa9a69cbc4a0f4901c73c65e78a (diff) | |
| parent | af099a9b53616fdc38392c86236d00413cdc14c5 (diff) | |
Merge pull request #1080 from Bond-009/httpclient
Remove usage of deprecated 'WebRequest'
Diffstat (limited to 'Emby.Server.Implementations/ApplicationHost.cs')
| -rw-r--r-- | Emby.Server.Implementations/ApplicationHost.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index c39cff179..fc4e88878 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -6,6 +6,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Net; +using System.Net.Http; using System.Reflection; using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; @@ -1538,12 +1539,12 @@ namespace Emby.Server.Implementations LogErrorResponseBody = false, LogErrors = false, LogRequest = false, - TimeoutMs = 10000, BufferContent = false, CancellationToken = cancellationToken }).ConfigureAwait(false)) { - return GetWanApiUrl(response.ReadToEnd().Trim()); + string res = await response.ReadToEndAsync().ConfigureAwait(false); + return GetWanApiUrl(res.Trim()); } } catch (Exception ex) @@ -1696,15 +1697,15 @@ namespace Emby.Server.Implementations LogErrorResponseBody = false, LogErrors = LogPing, LogRequest = LogPing, - TimeoutMs = 5000, BufferContent = false, CancellationToken = cancellationToken - }, "POST").ConfigureAwait(false)) + + }, HttpMethod.Post).ConfigureAwait(false)) { using (var reader = new StreamReader(response.Content)) { - var result = reader.ReadToEnd(); + var result = await reader.ReadToEndAsync().ConfigureAwait(false); var valid = string.Equals(Name, result, StringComparison.OrdinalIgnoreCase); _validAddressResults.AddOrUpdate(apiUrl, valid, (k, v) => valid); |
