Browse Source

Dispose httpclient response

crobibero 5 years ago
parent
commit
8da646e12b

+ 1 - 1
Jellyfin.Api/Controllers/LiveTvController.cs

@@ -1071,7 +1071,7 @@ namespace Jellyfin.Api.Controllers
         {
         {
             var client = _httpClientFactory.CreateClient();
             var client = _httpClientFactory.CreateClient();
             // https://json.schedulesdirect.org/20141201/available/countries
             // https://json.schedulesdirect.org/20141201/available/countries
-            var response = await client.GetAsync("https://json.schedulesdirect.org/20141201/available/countries")
+            using var response = await client.GetAsync("https://json.schedulesdirect.org/20141201/available/countries")
                 .ConfigureAwait(false);
                 .ConfigureAwait(false);
 
 
             return File(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), MediaTypeNames.Application.Json);
             return File(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), MediaTypeNames.Application.Json);

+ 1 - 1
Jellyfin.Api/Controllers/RemoteImageController.cs

@@ -245,7 +245,7 @@ namespace Jellyfin.Api.Controllers
         private async Task DownloadImage(string url, Guid urlHash, string pointerCachePath)
         private async Task DownloadImage(string url, Guid urlHash, string pointerCachePath)
         {
         {
             var httpClient = _httpClientFactory.CreateClient();
             var httpClient = _httpClientFactory.CreateClient();
-            var response = await httpClient.GetAsync(url).ConfigureAwait(false);
+            using var response = await httpClient.GetAsync(url).ConfigureAwait(false);
             var ext = response.Content.Headers.ContentType.MediaType.Split('/').Last();
             var ext = response.Content.Headers.ContentType.MediaType.Split('/').Last();
             var fullCachePath = GetFullCachePath(urlHash + "." + ext);
             var fullCachePath = GetFullCachePath(urlHash + "." + ext);