Processor
Include fastly/esi.h to use this class.
An ESI processor that can process a response containing ESI tags, dispatch requests for fragments, and process the fragment responses.
Constructor
fastly::esi::Processor::Processor(std::optional<Request> original_request_metadata = std::nullopt, Configuration config = Configuration())Create a new ESI processor with the given configuration.
Parameters
- original_request_metadata: std::optional<Request>optional =
std::nullopt - config: Configurationoptional =
Configuration()
Methods
process_document
View sourcefastly::expected<std::string> fastly::esi::Processor::process_document(const std::string &src_document, std::optional<DispatchFragmentRequestFn> dispatch_fragment_request = std::nullopt, std::optional<ProcessFragmentResponseFn> process_fragment_response = std::nullopt)Process a string containing ESI tags, optionally using the given callbacks to dispatch requests for fragments and process the fragment responses.
Parameters
- src_document: const std::string &
The string containing ESI tags to process.
- dispatch_fragment_request: std::optional<DispatchFragmentRequestFn>optional =
std::nullopt Optional callback to dispatch requests for fragments.
- process_fragment_response: std::optional<ProcessFragmentResponseFn>optional =
std::nullopt Optional callback to process fragment responses.
Returns
process_response
View sourcefastly::expected<void> fastly::esi::Processor::process_response(Response &src_document, std::optional<Response> client_response_metadata = std::nullopt, std::optional<DispatchFragmentRequestFn> dispatch_fragment_request = std::nullopt, std::optional<ProcessFragmentResponseFn> process_fragment_response = std::nullopt)Process a response containing ESI tags, optionally using the given callbacks to dispatch requests for fragments and process the fragment responses.
Parameters
- src_document: Response &
The response containing ESI tags to process.
- client_response_metadata: std::optional<Response>optional =
std::nullopt Optional original client request data used for fragment requests.
- dispatch_fragment_request: std::optional<DispatchFragmentRequestFn>optional =
std::nullopt Optional callback to dispatch requests for fragments.
- process_fragment_response: std::optional<ProcessFragmentResponseFn>optional =
std::nullopt Optional callback to process fragment responses.
Returns