Table of Contents

Class DefaultHttpRequester

Namespace
AngleSharp.Io
Assembly
AngleSharp.dll

The default (ready-to-use) HTTP requester.

public sealed class DefaultHttpRequester : BaseRequester, IRequester, IEventTarget
Inheritance
DefaultHttpRequester
Implements
Inherited Members
Extension Methods

Constructors

DefaultHttpRequester(string?, Action<HttpWebRequest>?)

Constructs a default HTTP requester with the information presented in the info object.

public DefaultHttpRequester(string? userAgent = null, Action<HttpWebRequest>? setup = null)

Parameters

userAgent string

The user-agent name to use, if any.

setup Action<HttpWebRequest>

An optional setup function for the HttpWebRequest object.

Properties

Headers

Gets the used headers.

public IDictionary<string, string> Headers { get; }

Property Value

IDictionary<string, string>

Timeout

Gets or sets the timeout value.

public TimeSpan Timeout { get; set; }

Property Value

TimeSpan

Methods

PerformRequestAsync(Request, CancellationToken)

Performs an asynchronous http request that can be cancelled.

protected override Task<IResponse?> PerformRequestAsync(Request request, CancellationToken cancellationToken)

Parameters

request Request

The options to consider.

cancellationToken CancellationToken

The token for cancelling the task.

Returns

Task<IResponse>

The task that will eventually give the response data.

SupportsProtocol(string)

Checks if the given protocol is supported.

public override bool SupportsProtocol(string protocol)

Parameters

protocol string

The protocol to check for, e.g. http.

Returns

bool

True if the protocol is supported, otherwise false.