Browse Source

Merge pull request #6592 from Bond-009/dlna3

Claus Vium 3 years ago
parent
commit
7c8a81f7bc
1 changed files with 6 additions and 2 deletions
  1. 6 2
      Emby.Dlna/PlayTo/SsdpHttpClient.cs

+ 6 - 2
Emby.Dlna/PlayTo/SsdpHttpClient.cs

@@ -45,10 +45,12 @@ namespace Emby.Dlna.PlayTo
                     header,
                     header,
                     cancellationToken)
                     cancellationToken)
                 .ConfigureAwait(false);
                 .ConfigureAwait(false);
+            response.EnsureSuccessStatusCode();
+
             await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
             await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
             return await XDocument.LoadAsync(
             return await XDocument.LoadAsync(
                 stream,
                 stream,
-                LoadOptions.PreserveWhitespace,
+                LoadOptions.None,
                 cancellationToken).ConfigureAwait(false);
                 cancellationToken).ConfigureAwait(false);
         }
         }
 
 
@@ -86,6 +88,7 @@ namespace Emby.Dlna.PlayTo
             using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
             using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
                 .SendAsync(options, HttpCompletionOption.ResponseHeadersRead)
                 .SendAsync(options, HttpCompletionOption.ResponseHeadersRead)
                 .ConfigureAwait(false);
                 .ConfigureAwait(false);
+            response.EnsureSuccessStatusCode();
         }
         }
 
 
         public async Task<XDocument> GetDataAsync(string url, CancellationToken cancellationToken)
         public async Task<XDocument> GetDataAsync(string url, CancellationToken cancellationToken)
@@ -94,12 +97,13 @@ namespace Emby.Dlna.PlayTo
             options.Headers.UserAgent.ParseAdd(USERAGENT);
             options.Headers.UserAgent.ParseAdd(USERAGENT);
             options.Headers.TryAddWithoutValidation("FriendlyName.DLNA.ORG", FriendlyName);
             options.Headers.TryAddWithoutValidation("FriendlyName.DLNA.ORG", FriendlyName);
             using var response = await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
             using var response = await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+            response.EnsureSuccessStatusCode();
             await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
             await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
             try
             try
             {
             {
                 return await XDocument.LoadAsync(
                 return await XDocument.LoadAsync(
                     stream,
                     stream,
-                    LoadOptions.PreserveWhitespace,
+                    LoadOptions.None,
                     cancellationToken).ConfigureAwait(false);
                     cancellationToken).ConfigureAwait(false);
             }
             }
             catch
             catch