Remove more unused stuff
This commit is contained in:
parent
067200be83
commit
0a5550b13d
|
@ -6,6 +6,7 @@ using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
@ -1560,12 +1561,12 @@ namespace Emby.Server.Implementations
|
||||||
LogErrorResponseBody = false,
|
LogErrorResponseBody = false,
|
||||||
LogErrors = false,
|
LogErrors = false,
|
||||||
LogRequest = false,
|
LogRequest = false,
|
||||||
TimeoutMs = 10000,
|
|
||||||
BufferContent = false,
|
BufferContent = false,
|
||||||
CancellationToken = cancellationToken
|
CancellationToken = cancellationToken
|
||||||
}).ConfigureAwait(false))
|
}).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return GetWanApiUrl(response.ReadToEnd().Trim());
|
string res = await response.ReadToEndAsync().ConfigureAwait(false);
|
||||||
|
return GetWanApiUrl(res.Trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -1717,15 +1718,15 @@ namespace Emby.Server.Implementations
|
||||||
LogErrorResponseBody = false,
|
LogErrorResponseBody = false,
|
||||||
LogErrors = LogPing,
|
LogErrors = LogPing,
|
||||||
LogRequest = LogPing,
|
LogRequest = LogPing,
|
||||||
TimeoutMs = 5000,
|
|
||||||
BufferContent = false,
|
BufferContent = false,
|
||||||
|
|
||||||
CancellationToken = cancellationToken
|
CancellationToken = cancellationToken
|
||||||
}, "POST").ConfigureAwait(false))
|
}, HttpMethod.Post).ConfigureAwait(false))
|
||||||
|
|
||||||
{
|
{
|
||||||
using (var reader = new StreamReader(response.Content))
|
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);
|
var valid = string.Equals(Name, result, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
_validAddressResults.AddOrUpdate(apiUrl, valid, (k, v) => valid);
|
_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)
|
if (options.LogRequest)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToString(), options.Url);
|
_logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToString(), options.Url);
|
||||||
|
@ -397,10 +392,6 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
{
|
{
|
||||||
throw GetCancellationException(options, options.CancellationToken, ex);
|
throw GetCancellationException(options, options.CancellationToken, ex);
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
options.ResourcePool?.Release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpResponseInfo GetResponseInfo(HttpResponseMessage httpResponse, Stream content, long? contentLength, IDisposable disposable)
|
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);
|
var httpWebRequest = GetRequestMessage(options, HttpMethod.Get);
|
||||||
|
|
||||||
if (options.ResourcePool != null)
|
|
||||||
{
|
|
||||||
await options.ResourcePool.WaitAsync(options.CancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
options.Progress.Report(0);
|
options.Progress.Report(0);
|
||||||
|
|
||||||
if (options.LogRequest)
|
if (options.LogRequest)
|
||||||
|
@ -528,10 +514,6 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
|
|
||||||
throw GetException(ex, options);
|
throw GetException(ex, options);
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
options.ResourcePool?.Release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Exception GetException(Exception ex, HttpRequestOptions options)
|
private Exception GetException(Exception ex, HttpRequestOptions options)
|
||||||
|
|
|
@ -96,8 +96,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
Url = ApiUrl + "/schedules",
|
Url = ApiUrl + "/schedules",
|
||||||
UserAgent = UserAgent,
|
UserAgent = UserAgent,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
// The data can be large so give it some extra time
|
|
||||||
TimeoutMs = 60000,
|
|
||||||
LogErrorResponseBody = true,
|
LogErrorResponseBody = true,
|
||||||
RequestContent = requestString
|
RequestContent = requestString
|
||||||
};
|
};
|
||||||
|
@ -115,9 +113,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
Url = ApiUrl + "/programs",
|
Url = ApiUrl + "/programs",
|
||||||
UserAgent = UserAgent,
|
UserAgent = UserAgent,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
LogErrorResponseBody = true,
|
LogErrorResponseBody = true
|
||||||
// The data can be large so give it some extra time
|
|
||||||
TimeoutMs = 60000
|
|
||||||
};
|
};
|
||||||
|
|
||||||
httpOptions.RequestHeaders["token"] = token;
|
httpOptions.RequestHeaders["token"] = token;
|
||||||
|
@ -483,8 +479,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
RequestContent = imageIdString,
|
RequestContent = imageIdString,
|
||||||
LogErrorResponseBody = true,
|
LogErrorResponseBody = true,
|
||||||
// The data can be large so give it some extra time
|
|
||||||
TimeoutMs = 60000
|
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -871,8 +865,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
UserAgent = UserAgent,
|
UserAgent = UserAgent,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
LogErrorResponseBody = true,
|
LogErrorResponseBody = true,
|
||||||
// The data can be large so give it some extra time
|
|
||||||
TimeoutMs = 60000
|
|
||||||
};
|
};
|
||||||
|
|
||||||
httpOptions.RequestHeaders["token"] = token;
|
httpOptions.RequestHeaders["token"] = token;
|
||||||
|
|
|
@ -138,7 +138,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
{
|
{
|
||||||
Url = string.Format("{0}/discover.json", GetApiUrl(info)),
|
Url = string.Format("{0}/discover.json", GetApiUrl(info)),
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(10).TotalMilliseconds),
|
|
||||||
BufferContent = false
|
BufferContent = false
|
||||||
|
|
||||||
}, "GET").ConfigureAwait(false))
|
}, "GET").ConfigureAwait(false))
|
||||||
|
@ -191,7 +190,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
{
|
{
|
||||||
Url = string.Format("{0}/tuners.html", GetApiUrl(info)),
|
Url = string.Format("{0}/tuners.html", GetApiUrl(info)),
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds),
|
|
||||||
BufferContent = false
|
BufferContent = false
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,13 +47,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
CancellationToken = CancellationToken.None,
|
CancellationToken = CancellationToken.None,
|
||||||
BufferContent = false,
|
BufferContent = false,
|
||||||
|
|
||||||
// Increase a little bit
|
|
||||||
TimeoutMs = 30000,
|
|
||||||
|
|
||||||
EnableHttpCompression = false,
|
EnableHttpCompression = false,
|
||||||
|
|
||||||
LogResponse = true,
|
|
||||||
LogResponseHeaders = true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var header in mediaSource.RequiredHttpHeaders)
|
foreach (var header in mediaSource.RequiredHttpHeaders)
|
||||||
|
|
|
@ -28,18 +28,13 @@ namespace MediaBrowser.Common.Net
|
||||||
get => GetHeaderValue(HeaderNames.Accept);
|
get => GetHeaderValue(HeaderNames.Accept);
|
||||||
set => RequestHeaders[HeaderNames.Accept] = value;
|
set => RequestHeaders[HeaderNames.Accept] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the cancellation token.
|
/// Gets or sets the cancellation token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The cancellation token.</value>
|
/// <value>The cancellation token.</value>
|
||||||
public CancellationToken CancellationToken { get; set; }
|
public CancellationToken CancellationToken { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the resource pool.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The resource pool.</value>
|
|
||||||
public SemaphoreSlim ResourcePool { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user agent.
|
/// Gets or sets the user agent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -86,8 +81,6 @@ namespace MediaBrowser.Common.Net
|
||||||
public bool LogRequest { get; set; }
|
public bool LogRequest { get; set; }
|
||||||
public bool LogRequestAsDebug { get; set; }
|
public bool LogRequestAsDebug { get; set; }
|
||||||
public bool LogErrors { get; set; }
|
public bool LogErrors { get; set; }
|
||||||
public bool LogResponse { get; set; }
|
|
||||||
public bool LogResponseHeaders { get; set; }
|
|
||||||
|
|
||||||
public bool LogErrorResponseBody { get; set; }
|
public bool LogErrorResponseBody { get; set; }
|
||||||
public bool EnableKeepAlive { get; set; }
|
public bool EnableKeepAlive { get; set; }
|
||||||
|
@ -95,7 +88,6 @@ namespace MediaBrowser.Common.Net
|
||||||
public CacheMode CacheMode { get; set; }
|
public CacheMode CacheMode { get; set; }
|
||||||
public TimeSpan CacheLength { get; set; }
|
public TimeSpan CacheLength { get; set; }
|
||||||
|
|
||||||
public int TimeoutMs { get; set; }
|
|
||||||
public bool EnableDefaultUserAgent { get; set; }
|
public bool EnableDefaultUserAgent { get; set; }
|
||||||
|
|
||||||
public bool AppendCharsetToMimeType { get; set; }
|
public bool AppendCharsetToMimeType { get; set; }
|
||||||
|
@ -119,17 +111,6 @@ namespace MediaBrowser.Common.Net
|
||||||
LogRequest = true;
|
LogRequest = true;
|
||||||
LogErrors = true;
|
LogErrors = true;
|
||||||
CacheMode = CacheMode.None;
|
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