|
|
|
@ -1,5 +1,9 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Net.Http.Headers;
|
|
|
|
|
using System.Net.Mime;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Jellyfin.Networking.Configuration;
|
|
|
|
|
using Jellyfin.Server.Extensions;
|
|
|
|
|
using Jellyfin.Server.Implementations;
|
|
|
|
@ -67,6 +71,12 @@ namespace Jellyfin.Server
|
|
|
|
|
var acceptJsonHeader = new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Json, 1.0);
|
|
|
|
|
var acceptXmlHeader = new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Xml, 0.9);
|
|
|
|
|
var acceptAnyHeader = new MediaTypeWithQualityHeaderValue("*/*", 0.8);
|
|
|
|
|
Func<IServiceProvider, HttpMessageHandler> defaultHttpClientHandlerDelegate = (_) => new SocketsHttpHandler()
|
|
|
|
|
{
|
|
|
|
|
AutomaticDecompression = DecompressionMethods.All,
|
|
|
|
|
RequestHeaderEncodingSelector = (_, _) => Encoding.UTF8
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services
|
|
|
|
|
.AddHttpClient(NamedClient.Default, c =>
|
|
|
|
|
{
|
|
|
|
@ -75,7 +85,7 @@ namespace Jellyfin.Server
|
|
|
|
|
c.DefaultRequestHeaders.Accept.Add(acceptXmlHeader);
|
|
|
|
|
c.DefaultRequestHeaders.Accept.Add(acceptAnyHeader);
|
|
|
|
|
})
|
|
|
|
|
.ConfigurePrimaryHttpMessageHandler(x => new DefaultHttpClientHandler());
|
|
|
|
|
.ConfigurePrimaryHttpMessageHandler(defaultHttpClientHandlerDelegate);
|
|
|
|
|
|
|
|
|
|
services.AddHttpClient(NamedClient.MusicBrainz, c =>
|
|
|
|
|
{
|
|
|
|
@ -84,7 +94,7 @@ namespace Jellyfin.Server
|
|
|
|
|
c.DefaultRequestHeaders.Accept.Add(acceptXmlHeader);
|
|
|
|
|
c.DefaultRequestHeaders.Accept.Add(acceptAnyHeader);
|
|
|
|
|
})
|
|
|
|
|
.ConfigurePrimaryHttpMessageHandler(x => new DefaultHttpClientHandler());
|
|
|
|
|
.ConfigurePrimaryHttpMessageHandler(defaultHttpClientHandlerDelegate);
|
|
|
|
|
|
|
|
|
|
services.AddHealthChecks()
|
|
|
|
|
.AddDbContextCheck<JellyfinDb>();
|
|
|
|
|