Remove more unused stuff
This commit is contained in:
parent
369785c184
commit
7f42dcc60f
|
@ -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;
|
||||
|
@ -34,7 +35,6 @@ using Emby.Server.Implementations.IO;
|
|||
using Emby.Server.Implementations.Library;
|
||||
using Emby.Server.Implementations.LiveTv;
|
||||
using Emby.Server.Implementations.Localization;
|
||||
using Emby.Server.Implementations.Middleware;
|
||||
using Emby.Server.Implementations.Net;
|
||||
using Emby.Server.Implementations.Playlists;
|
||||
using Emby.Server.Implementations.Reflection;
|
||||
|
@ -1479,12 +1479,12 @@ namespace Emby.Server.Implementations
|
|||
LogErrorResponseBody = false,
|
||||
LogErrors = false,
|
||||
LogRequest = false,
|
||||
TimeoutMs = 10000,
|
||||
BufferContent = false,
|
||||
CancellationToken = cancellationToken
|
||||
}))
|
||||
{
|
||||
return GetLocalApiUrl(response.ReadToEnd().Trim());
|
||||
string res = await response.ReadToEndAsync().ConfigureAwait(false);
|
||||
return GetLocalApiUrl(res.Trim());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -1604,16 +1604,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);
|
||||
|
|
|
@ -352,11 +352,6 @@ namespace Emby.Server.Implementations.HttpClientManager
|
|||
}
|
||||
}
|
||||
|
||||
if (options.ResourcePool != null)
|
||||
{
|
||||
await options.ResourcePool.WaitAsync(options.CancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (options.LogRequest)
|
||||
{
|
||||
_logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToString(), options.Url);
|
||||
|
@ -397,10 +392,6 @@ namespace Emby.Server.Implementations.HttpClientManager
|
|||
{
|
||||
throw GetCancellationException(options, options.CancellationToken, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
options.ResourcePool?.Release();
|
||||
}
|
||||
}
|
||||
|
||||
private HttpResponseInfo GetResponseInfo(HttpResponseMessage httpResponse, Stream content, long? contentLength, IDisposable disposable)
|
||||
|
@ -483,11 +474,6 @@ namespace Emby.Server.Implementations.HttpClientManager
|
|||
|
||||
var httpWebRequest = GetRequestMessage(options, HttpMethod.Get);
|
||||
|
||||
if (options.ResourcePool != null)
|
||||
{
|
||||
await options.ResourcePool.WaitAsync(options.CancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
options.Progress.Report(0);
|
||||
|
||||
if (options.LogRequest)
|
||||
|
@ -528,10 +514,6 @@ namespace Emby.Server.Implementations.HttpClientManager
|
|||
|
||||
throw GetException(ex, options);
|
||||
}
|
||||
finally
|
||||
{
|
||||
options.ResourcePool?.Release();
|
||||
}
|
||||
}
|
||||
|
||||
private Exception GetException(Exception ex, HttpRequestOptions options)
|
||||
|
|
|
@ -96,8 +96,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
Url = ApiUrl + "/schedules",
|
||||
UserAgent = UserAgent,
|
||||
CancellationToken = cancellationToken,
|
||||
// The data can be large so give it some extra time
|
||||
TimeoutMs = 60000,
|
||||
LogErrorResponseBody = true,
|
||||
RequestContent = requestString
|
||||
};
|
||||
|
@ -115,9 +113,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
Url = ApiUrl + "/programs",
|
||||
UserAgent = UserAgent,
|
||||
CancellationToken = cancellationToken,
|
||||
LogErrorResponseBody = true,
|
||||
// The data can be large so give it some extra time
|
||||
TimeoutMs = 60000
|
||||
LogErrorResponseBody = true
|
||||
};
|
||||
|
||||
httpOptions.RequestHeaders["token"] = token;
|
||||
|
@ -483,8 +479,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
CancellationToken = cancellationToken,
|
||||
RequestContent = imageIdString,
|
||||
LogErrorResponseBody = true,
|
||||
// The data can be large so give it some extra time
|
||||
TimeoutMs = 60000
|
||||
};
|
||||
|
||||
try
|
||||
|
@ -871,8 +865,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
UserAgent = UserAgent,
|
||||
CancellationToken = cancellationToken,
|
||||
LogErrorResponseBody = true,
|
||||
// The data can be large so give it some extra time
|
||||
TimeoutMs = 60000
|
||||
};
|
||||
|
||||
httpOptions.RequestHeaders["token"] = token;
|
||||
|
|
|
@ -138,7 +138,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
{
|
||||
Url = string.Format("{0}/discover.json", GetApiUrl(info)),
|
||||
CancellationToken = cancellationToken,
|
||||
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(10).TotalMilliseconds),
|
||||
BufferContent = false
|
||||
|
||||
}, "GET").ConfigureAwait(false))
|
||||
|
@ -191,7 +190,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
{
|
||||
Url = string.Format("{0}/tuners.html", GetApiUrl(info)),
|
||||
CancellationToken = cancellationToken,
|
||||
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds),
|
||||
BufferContent = false
|
||||
}))
|
||||
{
|
||||
|
|
|
@ -47,13 +47,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
|||
CancellationToken = CancellationToken.None,
|
||||
BufferContent = false,
|
||||
|
||||
// Increase a little bit
|
||||
TimeoutMs = 30000,
|
||||
|
||||
EnableHttpCompression = false,
|
||||
|
||||
LogResponse = true,
|
||||
LogResponseHeaders = true
|
||||
};
|
||||
|
||||
foreach (var header in mediaSource.RequiredHttpHeaders)
|
||||
|
|
|
@ -28,18 +28,13 @@ namespace MediaBrowser.Common.Net
|
|||
get => GetHeaderValue(HeaderNames.Accept);
|
||||
set => RequestHeaders[HeaderNames.Accept] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cancellation token.
|
||||
/// </summary>
|
||||
/// <value>The cancellation token.</value>
|
||||
public CancellationToken CancellationToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the resource pool.
|
||||
/// </summary>
|
||||
/// <value>The resource pool.</value>
|
||||
public SemaphoreSlim ResourcePool { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user agent.
|
||||
/// </summary>
|
||||
|
@ -86,8 +81,6 @@ namespace MediaBrowser.Common.Net
|
|||
public bool LogRequest { get; set; }
|
||||
public bool LogRequestAsDebug { get; set; }
|
||||
public bool LogErrors { get; set; }
|
||||
public bool LogResponse { get; set; }
|
||||
public bool LogResponseHeaders { get; set; }
|
||||
|
||||
public bool LogErrorResponseBody { get; set; }
|
||||
public bool EnableKeepAlive { get; set; }
|
||||
|
@ -95,7 +88,6 @@ namespace MediaBrowser.Common.Net
|
|||
public CacheMode CacheMode { get; set; }
|
||||
public TimeSpan CacheLength { get; set; }
|
||||
|
||||
public int TimeoutMs { get; set; }
|
||||
public bool EnableDefaultUserAgent { get; set; }
|
||||
|
||||
public bool AppendCharsetToMimeType { get; set; }
|
||||
|
@ -119,17 +111,6 @@ namespace MediaBrowser.Common.Net
|
|||
LogRequest = true;
|
||||
LogErrors = true;
|
||||
CacheMode = CacheMode.None;
|
||||
|
||||
TimeoutMs = 20000;
|
||||
}
|
||||
|
||||
public void SetPostData(IDictionary<string, string> values)
|
||||
{
|
||||
var strings = values.Keys.Select(key => string.Format("{0}={1}", key, values[key]));
|
||||
var postContent = string.Join("&", strings.ToArray());
|
||||
|
||||
RequestContent = postContent;
|
||||
RequestContentType = "application/x-www-form-urlencoded";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user