mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-08-03 22:40:09 +00:00
mono fixes for http requests
This commit is contained in:
parent
6247929a62
commit
d2332264b3
3 changed files with 30 additions and 9 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue