Here are the complete list of usable constructors, functions and properties.

Constructors

var request = new HTTPRequest(new Uri("https://example.org"));
var request = new HTTPRequest(new Uri("https://example.org"), callback: OnRequestFinished);

void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
{
}
var request = new HTTPRequest(new Uri("https://example.org"), isKeepAlive: false, callback: OnRequestFinished);

void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
{
}

Notice

isKeepAlive is just a hint. For example if the plugin can negotiate a HTTP/2 connection, it's still going to keep the connection alive.

var request = new HTTPRequest(new Uri("https://example.org"), isKeepAlive: true, disableCache: false, callback: OnRequestFinished);

void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
{
}
var request = new HTTPRequest(new Uri("https://example.org"), methodType: HTTPMethods.Post);
var request = new HTTPRequest(new Uri("https://example.org"), methodType: HTTPMethods.Post, callback: OnRequestFinished);

void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
{
}
var request = new HTTPRequest(new Uri("https://example.org"), methodType: HTTPMethods.Post, isKeepAlive: false, callback: OnRequestFinished);

void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
{
}
var request = new HTTPRequest(new Uri("https://example.org"), methodType: HTTPMethods.Post, isKeepAlive: false, disableCache: true, callback: OnRequestFinished);

void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
{
}

Properties

Notice

If there's an active connection to the server the plugin doesn't check what SSL/TLS handler is used for that connection,

Events

Notice

There are download modes where we can't figure out the exact length of the final content. In these cases we just guarantee that the third parameter will be at least the size of the second one.

Form Functions

HTTP defines two types of form encoding: URL Encoded and Multipart Forms. The plugin supports both of them and selects the most performing one automatically. Sometime servers supports one specific encoding only and expects data in that one encoding. In this case the FormUsage property can be used to force the plugin to use that encoding method for the request:

var request = new HTTPRequest(new Uri("https://httpbin.org/post"), HTTPMethods.Post, OnRequestFinished);

request.AddField("field name", "field value");
request.FormUsage = BestHTTP.Forms.HTTPFormUsage.Multipart;

request.Send();

Notice

These functions can be used to send forms, sending JSon or any other data the RawData or UploadStream properties can be used!

Header Functions

Long headers can be sent as one or more headers (for example the server might send multiple set-cookie headers), hence the plugin stores them in a list and GetHeaderValues returns with it. To help work with them easier, GetFirstHeaderValue returns with the first value from the list. This can be used when we know that the server going to send only one header.

Range Header Functions

Range headers can be used to resume to an unfinished download, download only parts of a (large) content or download multiple parts in parallel.

Other Functions