Table of Contents

Class BaseLoader

Namespace
AngleSharp.Io
Assembly
AngleSharp.dll

Represents the base class for all loaders.

public abstract class BaseLoader : ILoader
Inheritance
BaseLoader
Implements
Derived
Inherited Members
Extension Methods

Constructors

BaseLoader(IBrowsingContext, Predicate<Request>?)

Creates a new resource loader.

public BaseLoader(IBrowsingContext context, Predicate<Request>? filter)

Parameters

context IBrowsingContext

The context to use.

filter Predicate<Request>

The optional request filter to use.

Properties

MaxRedirects

Gets the maximum number of redirects. By default this is 50.

public int MaxRedirects { get; protected set; }

Property Value

int

Methods

Add(IDownload)

Adds the download to the active downloads.

protected virtual void Add(IDownload download)

Parameters

download IDownload

The download to add.

CreateNewRequest(Request, IResponse)

Creates a new request based on the existing request and given response.

protected static Request CreateNewRequest(Request request, IResponse response)

Parameters

request Request

The previous request.

response IResponse

The response to the previous request.

Returns

Request

The new request to issue.

DownloadAsync(Request, INode?)

Starts downloading the request.

protected virtual IDownload DownloadAsync(Request request, INode? originator)

Parameters

request Request

The request data.

originator INode

The request's originator.

Returns

IDownload

The active download.

GetCookie(Url)

Gets the cookie string for the given URL.

protected virtual string GetCookie(Url url)

Parameters

url Url

The requested URL.

Returns

string

The associated cookie string, if any.

GetDownloads()

Gets the active downloads.

public IEnumerable<IDownload> GetDownloads()

Returns

IEnumerable<IDownload>

The enumerable over all active downloads.

LoadAsync(Request, CancellationToken)

Loads the given URI by using an asynchronous request.

protected Task<IResponse> LoadAsync(Request request, CancellationToken cancel)

Parameters

request Request

The data of the request to send.

cancel CancellationToken

The cancellation token to use..

Returns

Task<IResponse>

The task which will eventually return the response.

Remove(IDownload)

Removes the download from the active downloads.

protected virtual void Remove(IDownload download)

Parameters

download IDownload

The download to remove.

SetCookie(Url, string)

Sets the cookie string for the given URL.

protected virtual void SetCookie(Url url, string value)

Parameters

url Url

The requested URL.

value string

The value of the cookie.