SimpleHttp

Description

abstract class Tinman.Core.IO.SimpleHttp

Derived from

Disposable abstract
ISimpleHttp

Default implementation of the ISimpleHttp interface.

Public / Constructors

Create


[OwnerReturn]
public static method Create → (4)

userAgent opt : string = null

Specifies the HTTP User-Agent string to use. If null, empty or malformed, the following string will be used: 'Tinman3D/X.Y', where X and Y are the major resp. minor version numbers of TinmanCoreModule (see TinmanModule.Info).

decodeImage opt : ISimpleHttpImage = null

The ISimpleHttpImage object to use for decoding image data. If null, ISimpleHttp.GetImage will always return an HTTP error code.

decodeText opt : ISimpleHttpText = null

The ISimpleHttpText object to use for decoding text data. If null, ISimpleHttp.GetText will always return an HTTP error code.

curl opt : int32 = 0

If possible, the SimpleHttp class will use the default HTTP stack of the enclosing system, for example the Windows HTTP Services (WinHTTP) for C++ and System.Net.Http.HttpClient for C#. If there is no such default HTTP stack, the cURL library (https://curl.se) will be used, assuming that is has been installed on the system. This parameter can be used to adjust this behaviour:
< 0 : cURL will never be used, even if there is no default HTTP stack,
= 0 : cURL will only be used if there is no default HTTP stack,
> 1 : cURL will always be used, even if there is a default HTTP stack.

returns → SimpleHttp

The created SimpleHttp object.

Creates a new instance of SimpleHttp.

Protected / Constructors

Simple​Http


protected constructor SimpleHttp → (2)

decodeImage opt : ISimpleHttpImage = null

The ISimpleHttpImage object to use for decoding image data. If null, ISimpleHttp.GetImage will always return an HTTP error code.

decodeText opt : ISimpleHttpText = null

The ISimpleHttpText object to use for decoding text data. If null, ISimpleHttp.GetText will always return an HTTP error code.

Creates a new instance of SimpleHttp.

Protected / Methods

Apply​Options


protected abstract method ApplyOptions → ()

(Re-)applies the current option values.

Fix​User​Agent


[Pure]
protected static method FixUserAgent → (1)

userAgent in : string

The user agent string.

returns → string

The coalesced user agent string.

Coalesces the given user agent string.

Request​Cancel


protected method RequestCancel → (2)

monitor in : Monitor

The monitor to use.

requestId in : int32

The unique request ID.

returns → bool

true if the request has been cancelled, false if not.

Checks whether the given request has been cancelled.

Status​Code​Success


[Pure]
protected static method StatusCodeSuccess → (1)

code in : int32

The HTTP status code.

returns → bool

true if the request has succeeded, false if not.

Checks if the given HTTP status code indicates that the request has succeeded, i.e. the download has completed successfully.

Protected / Attributes

user​Agent


protected attribute userAgent → (string)

The user agent string.

Logging

Logger


public static readonly attribute Logger → (ILogger)

The logger object of this class.