The Free Software Media System - Server Backend & API
Properly migrate all HttpCompletionOption
crobibero4038d15c83da
diff --git a/Emby.Dlna/Eventing/DlnaEventManager.cs b/Emby.Dlna/Eventing/DlnaEventManager.csindex 0c7591494a..7d8da86ef9 100644--- a/Emby.Dlna/Eventing/DlnaEventManager.cs+++ b/Emby.Dlna/Eventing/DlnaEventManager.cs@@ -178,7 +178,7 @@ namespace Emby.Dlna.Eventingtry{using var response = await _httpClientFactory.CreateClient(NamedClient.Default)- .SendAsync(options).ConfigureAwait(false);+ .SendAsync(options, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);}catch (OperationCanceledException){diff --git a/Emby.Dlna/PlayTo/SsdpHttpClient.cs b/Emby.Dlna/PlayTo/SsdpHttpClient.csindex c6e9e074f1..65f1aab22e 100644--- a/Emby.Dlna/PlayTo/SsdpHttpClient.cs+++ b/Emby.Dlna/PlayTo/SsdpHttpClient.cs@@ -84,7 +84,7 @@ namespace Emby.Dlna.PlayTooptions.Headers.TryAddWithoutValidation("TIMEOUT", "Second-" + timeOut.ToString(_usCulture));using var response = await _httpClientFactory.CreateClient(NamedClient.Default)- .SendAsync(options)+ .SendAsync(options, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);}@@ -93,7 +93,7 @@ namespace Emby.Dlna.PlayTousing var options = new HttpRequestMessage(HttpMethod.Get, url);options.Headers.UserAgent.Add(ProductInfoHeaderValue.Parse(USERAGENT));options.Headers.TryAddWithoutValidation("FriendlyName.DLNA.ORG", FriendlyName);- using var response = await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, cancellationToken).ConfigureAwait(false);+ using var response = await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);using var reader = new StreamReader(stream, Encoding.UTF8);return XDocument.Parse(@@ -126,7 +126,7 @@ namespace Emby.Dlna.PlayTooptions.Content = new StringContent(postData, Encoding.UTF8, MediaTypeNames.Text.Xml);- return _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, cancellationToken);+ return _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, HttpCompletionOption.ResponseHeadersRead, cancellationToken);}}}diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex fbf4aef8b8..0060600790 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -1299,7 +1299,7 @@ namespace Emby.Server.Implementations{using var request = new HttpRequestMessage(HttpMethod.Post, apiUrl);using var response = await _httpClientFactory.CreateClient(NamedClient.Default)- .SendAsync(request, cancellationToken).ConfigureAwait(false);+ .SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);var result = await System.Text.Json.JsonSerializer.DeserializeAsync<string>(stream, JsonDefaults.GetOptions(), cancellationToken).ConfigureAwait(false);diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.csindex 377292cab8..a1037948b9 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprivate async Task RecordFromMediaSource(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken){using var response = await _httpClientFactory.CreateClient(NamedClient.Default)- .GetAsync(mediaSource.Path, cancellationToken).ConfigureAwait(false);+ .GetAsync(mediaSource.Path, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);_logger.LogInformation("Opened recording stream from tuner provider");diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.csindex 439e502781..f426a3336d 100644--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs@@ -607,11 +607,12 @@ namespace Emby.Server.Implementations.LiveTv.ListingsHttpRequestMessage options,bool enableRetry,ListingsProviderInfo providerInfo,- CancellationToken cancellationToken)+ CancellationToken cancellationToken,+ HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead){try{- return await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, cancellationToken).ConfigureAwait(false);+ return await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, completionOption, cancellationToken).ConfigureAwait(false);}catch (HttpException ex){@@ -670,7 +671,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingsusing var options = new HttpRequestMessage(HttpMethod.Put, ApiUrl + "/lineups/" + info.ListingsId);options.Headers.TryAddWithoutValidation("token", token);- using var response = await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, cancellationToken).ConfigureAwait(false);+ using var response = await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);}private async Task<bool> HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken)@@ -694,7 +695,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingstry{- using var httpResponse = await Send(options, false, null, cancellationToken).ConfigureAwait(false);+ using var httpResponse = await Send(options, false, null, cancellationToken, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);await using var stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);using var response = httpResponse.Content;var root = await _jsonSerializer.DeserializeFromStreamAsync<ScheduleDirect.Lineups>(stream).ConfigureAwait(false);diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.csindex 418e27eece..1873d17897 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs@@ -78,7 +78,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunBufferContent = false};- using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(model.LineupURL, cancellationToken).ConfigureAwait(false);+ using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(model.LineupURL, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);await using var stream = await response.Content.ReadAsStreamAsync();var lineup = await JsonSerializer.DeserializeAsync<List<Channels>>(stream, cancellationToken: cancellationToken).ConfigureAwait(false) ?? new List<Channels>();@@ -134,7 +134,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomeruntry{using var response = await _httpClientFactory.CreateClient(NamedClient.Default)- .GetAsync(string.Format(CultureInfo.InvariantCulture, "{0}/discover.json", GetApiUrl(info)), cancellationToken)+ .GetAsync(string.Format(CultureInfo.InvariantCulture, "{0}/discover.json", GetApiUrl(info)), HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);var discoverResponse = await JsonSerializer.DeserializeAsync<DiscoverResponse>(stream, cancellationToken: cancellationToken)@@ -180,7 +180,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunvar model = await GetModelInfo(info, false, cancellationToken).ConfigureAwait(false);using var response = await _httpClientFactory.CreateClient(NamedClient.Default)- .GetAsync(string.Format(CultureInfo.InvariantCulture, "{0}/tuners.html", GetApiUrl(info)), cancellationToken)+ .GetAsync(string.Format(CultureInfo.InvariantCulture, "{0}/tuners.html", GetApiUrl(info)), HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);using var sr = new StreamReader(stream, System.Text.Encoding.UTF8);diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.csindex 4c9722b292..7a16704a97 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs@@ -69,7 +69,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts}using var response = await _httpClientFactory.CreateClient(NamedClient.Default)- .GetAsync(url, CancellationToken.None)+ .GetAsync(url, HttpCompletionOption.ResponseHeadersRead, CancellationToken.None).ConfigureAwait(false);var extension = "ts";