cef_resource_handler_t

Structure used to implement a custom request handler structure. The functions of this structure will be called on the IO thread unless otherwise indicated.

Members

Variables

base
cef_base_ref_counted_t base;

Base structure.

cancel
void function(cef_resource_handler_t* self) nothrow cancel;

Request processing has been canceled.

get_response_headers
void function(cef_resource_handler_t* self, cef_response_t* response, long* response_length, cef_string_t* redirectUrl) nothrow get_response_headers;

Retrieve response header information. If the response length is not known set |response_length| to -1 and read_response() will be called until it returns false (0). If the response length is known set |response_length| to a positive value and read_response() will be called until it returns false (0) or the specified number of bytes have been read. Use the |response| object to set the mime type, http status code and other optional header values. To redirect the request to a new URL set |redirectUrl| to the new URL. |redirectUrl| can be either a relative or fully qualified URL. It is also possible to set |response| to a redirect http status code and pass the new URL via a Location header. Likewise with |redirectUrl| it is valid to set a relative or fully qualified URL as the Location header value. If an error occured while setting up the request you can call set_error() on |response| to indicate the error condition.

open
int function(cef_resource_handler_t* self, cef_request_t* request, int* handle_request, cef_callback_t* callback) nothrow open;

Open the response stream. To handle the request immediately set |handle_request| to true (1) and return true (1). To decide at a later time set |handle_request| to false (0), return true (1), and execute |callback| to continue or cancel the request. To cancel the request immediately set |handle_request| to true (1) and return false (0). This function will be called in sequence but not from a dedicated thread. For backwards compatibility set |handle_request| to false (0) and return false (0) and the ProcessRequest function will be called.

process_request
int function(cef_resource_handler_t* self, cef_request_t* request, cef_callback_t* callback) nothrow process_request;

Begin processing the request. To handle the request return true (1) and call cef_callback_t::cont() once the response header information is available (cef_callback_t::cont() can also be called from inside this function if header information is available immediately). To cancel the request return false (0).

read
int function(cef_resource_handler_t* self, void* data_out, int bytes_to_read, int* bytes_read, cef_resource_read_callback_t* callback) nothrow read;

Read response data. If data is available immediately copy up to |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of bytes copied, and return true (1). To read the data at a later time keep a pointer to |data_out|, set |bytes_read| to 0, return true (1) and execute |callback| when the data is available (|data_out| will remain valid until the callback is executed). To indicate response completion set |bytes_read| to 0 and return false (0). To indicate failure set |bytes_read| to < 0 (e.g. -2 for ERR_FAILED) and return false (0). This function will be called in sequence but not from a dedicated thread. For backwards compatibility set |bytes_read| to -1 and return false (0) and the ReadResponse function will be called.

read_response
int function(cef_resource_handler_t* self, void* data_out, int bytes_to_read, int* bytes_read, cef_callback_t* callback) nothrow read_response;

Read response data. If data is available immediately copy up to |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of bytes copied, and return true (1). To read the data at a later time set |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the data is available. To indicate response completion return false (0).

skip
int function(cef_resource_handler_t* self, long bytes_to_skip, long* bytes_skipped, cef_resource_skip_callback_t* callback) nothrow skip;

Skip response data when requested by a Range header. Skip over and discard |bytes_to_skip| bytes of response data. If data is available immediately set |bytes_skipped| to the number of bytes skipped and return true (1). To read the data at a later time set |bytes_skipped| to 0, return true (1) and execute |callback| when the data is available. To indicate failure set |bytes_skipped| to < 0 (e.g. -2 for ERR_FAILED) and return false (0). This function will be called in sequence but not from a dedicated thread.

Meta