Catalyst.HttpUtils
Description:
The HttpUtils namespace contains useful functions for executing HTTP requests.
Content:
Functions:
- public async void download_file_async (DownloadContext context, Cancellable? cancellable = null)
Downloads the file at the given URL asynchronously.
- public void download_file_sync (DownloadContext context, Cancellable? cancellable = null)
Downloads the file at the given URL.
- public string get_as_string (string url, Cancellable? cancellable = null) throws Error
Retrieves the content at the given URL as a string.
- public bool is_client_error (uint status_code)
Returns whether or not the given HTTP status code indicates an error
on on the client side (i.e. 4xx).
- public bool is_error (uint status_code)
Returns whether or not the given HTTP status code indicates an error
on either the client or the server side.
- public bool is_server_error (uint status_code)
Returns whether or not the given HTTP status code indicates an error
on on the server side (i.e. 5xx).
- public uint random_port (uint lower_bound = MIN_PORT, uint upper_bound = MAX_PORT)
Returns a valid, random port number equally distrubted over the range
provided by the lower and upper bounds.
- public uint random_port_for_range (PortRange port_range)
Returns a valid, random port number equally distrubted over the range.
- public bool validate_port (uint port_number)
Returns whether or not the given port number is valid.