C# Class WebsiteBuilder.HttpClientManager

Class HttpClientManager
Exibir arquivo Open project: MediaBrowser/website

Protected Properties

Property Type Description
UsCulture System.Globalization.CultureInfo

Public Methods

Method Description
Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Get ( HttpRequestOptions options ) : Task

Performs a GET request and returns the resulting stream

Get ( string url, CancellationToken cancellationToken ) : Task

Gets the specified URL.

Get ( string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken ) : Task

Performs a GET request and returns the resulting stream

GetResponse ( HttpRequestOptions options ) : Task

Gets the response internal.

HttpClientManager ( ) : System

Initializes a new instance of the HttpClientManager class.

Post ( HttpRequestOptions options ) : Task
Post ( HttpRequestOptions options, string>.Dictionary postData ) : Task

Performs a POST request

Post ( string url, string>.Dictionary postData, CancellationToken cancellationToken ) : Task

Posts the specified URL.

Post ( string url, string>.Dictionary postData, SemaphoreSlim resourcePool, CancellationToken cancellationToken ) : Task

Performs a POST request

SendAsync ( HttpRequestOptions options, string httpMethod ) : Task

send as an asynchronous operation.

Protected Methods

Method Description
Dispose ( bool dispose ) : void

Releases unmanaged and - optionally - managed resources.

Private Methods

Method Description
AddRequestHeaders ( HttpWebRequest request, HttpRequestOptions options ) : void
CacheResponse ( HttpResponseInfo response, string responseCachePath ) : Task
CreateWebRequest ( string url ) : WebRequest
EnsureSuccessStatusCode ( HttpClientInfo client, HttpWebResponse response, HttpRequestOptions options ) : void
GetCachedResponse ( string responseCachePath, System.TimeSpan cacheLength, string url ) : Task
GetCancellationException ( HttpRequestOptions options, HttpClientInfo client, CancellationToken cancellationToken, OperationCanceledException exception ) : Exception

Throws the cancellation exception.

GetContentLength ( HttpWebResponse response ) : long?
GetException ( Exception ex, HttpRequestOptions options, HttpClientInfo client ) : Exception
GetHostFromUrl ( string url ) : string

Gets the host from URL.

GetHttpClient ( string host, bool enableHttpCompression ) : HttpClientInfo

Gets

GetRequest ( HttpRequestOptions options, string method, bool enableHttpCompression ) : WebRequest
GetResponseAsync ( WebRequest request, System.TimeSpan timeout ) : Task
GetResponseInfo ( HttpWebResponse httpResponse, Stream content, long contentLength, IDisposable disposable ) : HttpResponseInfo
GetResponseInfo ( HttpWebResponse httpResponse, string tempFile, long contentLength ) : HttpResponseInfo
SendAsyncInternal ( HttpRequestOptions options, string httpMethod ) : Task
TimeoutCallback ( object state, bool timedOut ) : void
ValidateParams ( HttpRequestOptions options ) : void

Method Details

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

Dispose() protected method

Releases unmanaged and - optionally - managed resources.
protected Dispose ( bool dispose ) : void
dispose bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

Get() public method

Performs a GET request and returns the resulting stream
public Get ( HttpRequestOptions options ) : Task
options HttpRequestOptions The options.
return Task

Get() public method

Gets the specified URL.
public Get ( string url, CancellationToken cancellationToken ) : Task
url string The URL.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

Get() public method

Performs a GET request and returns the resulting stream
public Get ( string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken ) : Task
url string The URL.
resourcePool System.Threading.SemaphoreSlim The resource pool.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

GetResponse() public method

Gets the response internal.
public GetResponse ( HttpRequestOptions options ) : Task
options HttpRequestOptions The options.
return Task

HttpClientManager() public method

Initializes a new instance of the HttpClientManager class.
appPaths /// or /// logger
public HttpClientManager ( ) : System
return System

Post() public method

public Post ( HttpRequestOptions options ) : Task
options HttpRequestOptions
return Task

Post() public method

Performs a POST request
public Post ( HttpRequestOptions options, string>.Dictionary postData ) : Task
options HttpRequestOptions The options.
postData string>.Dictionary Params to add to the POST data.
return Task

Post() public method

Posts the specified URL.
public Post ( string url, string>.Dictionary postData, CancellationToken cancellationToken ) : Task
url string The URL.
postData string>.Dictionary The post data.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

Post() public method

Performs a POST request
public Post ( string url, string>.Dictionary postData, SemaphoreSlim resourcePool, CancellationToken cancellationToken ) : Task
url string The URL.
postData string>.Dictionary Params to add to the POST data.
resourcePool System.Threading.SemaphoreSlim The resource pool.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

SendAsync() public method

send as an asynchronous operation.
///
public SendAsync ( HttpRequestOptions options, string httpMethod ) : Task
options HttpRequestOptions The options.
httpMethod string The HTTP method.
return Task

Property Details

UsCulture protected_oe static_oe property

protected static CultureInfo,System.Globalization UsCulture
return System.Globalization.CultureInfo