ISimpleHttp
Description
- Derived from
- Extended by
-
SimpleHttp abstract
The ISimpleHttp interface provides methods for performing thread-safe synchronous HTTP
/HTTPS
requests for binary resources, images and plain text.
When a ISimpleHttp object is disposed, all pending requests will be cancelled, as if Cancel had been called prior to IDisposable.Dispose.
Public / Methods
Cancel
Cancels all pending HTTP requests.
A cancelled HTTP request has a SimpleHttpResult.StatusCode of 0
and an SimpleHttpResult.ErrorCode of IOError.Cancelled.
GetBytes
Performs an HTTP/1.1 GET request on the given binary resource byte range.
On success (see SimpleHttpResult.IsSuccess), exactly SimpleHttpResult.Length bytes have been written to buffer in, without updating its position. If the given byte range is empty (i.e. to opt is less than or equal to from opt), the whole resource content is requested.
The length of the requested data (see from opt and to opt) is clamped to the maximum number of bytes that can be written to the buffer in output range. Less data than requested may be written if the given byte range exceeds the size of the resource.
If the byte range is not empty and lies outside the file range, the HTTP server is supposed to return the status code 416 Requested Range Not Satisfiable
. This must be taken into account when GET
-ing consecutive byte chunks up to the end-of-file, since the from opt parameter could become equal to the file size.
- See also
GetImage
Performs an HTTP/1.0 GET request on the given image resource.
This method is intended to be used for downloading image tiles, which have a uniform size that is known beforehand. To download regular image resources, use Get and load the image content in a separate step.
- See also
Public / Attributes
Timeout
The request timeout.
The default timeout value is 15000
(i.e. 15 seconds).
An HTTP request that has timed out has a SimpleHttpResult.StatusCode of 0
and an SimpleHttpResult.ErrorCode of IOError.TimeOut