mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-19 07:23:05 +03:00
mono fixes for http requests
This commit is contained in:
@@ -101,10 +101,35 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||
return client;
|
||||
}
|
||||
|
||||
private PropertyInfo _httpBehaviorPropertyInfo;
|
||||
|
||||
private HttpWebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression)
|
||||
private WebRequest GetMonoRequest(HttpRequestOptions options, string method, bool enableHttpCompression)
|
||||
{
|
||||
var request = WebRequest.Create(options.Url);
|
||||
|
||||
if (!string.IsNullOrEmpty(options.AcceptHeader))
|
||||
{
|
||||
request.Headers.Add("Accept", options.AcceptHeader);
|
||||
}
|
||||
|
||||
request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate);
|
||||
request.ConnectionGroupName = GetHostFromUrl(options.Url);
|
||||
request.Method = method;
|
||||
request.Timeout = 20000;
|
||||
|
||||
if (!string.IsNullOrEmpty(options.UserAgent))
|
||||
{
|
||||
request.Headers.Add("User-Agent", options.UserAgent);
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private PropertyInfo _httpBehaviorPropertyInfo;
|
||||
private WebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression)
|
||||
{
|
||||
#if __MonoCS__
|
||||
return GetMonoRequest(options, method, enableHttpCompression);
|
||||
#endif
|
||||
|
||||
var request = HttpWebRequest.CreateHttp(options.Url);
|
||||
|
||||
if (!string.IsNullOrEmpty(options.AcceptHeader))
|
||||
|
||||
Reference in New Issue
Block a user