Description
Defines the optional response-compression encoder boundary.
The current Exchange sends fixed responses directly, so compression middleware is deliberately deferred until a bounded response-transform hook can preserve streaming, HEAD, no-body statuses, and partial-response safety. This interface fixes the provider boundary without selecting a compression dependency. Encoders must enforce an output bound and must not be installed for responses that mix secrets with attacker-controlled data unless the application has assessed compression side channels.
Content_Coding
function Content_Coding (Item : Encoder) return String
Return the HTTP content-coding token implemented by the encoder.
Parameters
- Item
Encoder
Return value
Content-coding token such as gzip
Encode
procedure Encode
(Item : in out Encoder;
Input : String;
Output : out Ada.Strings.Unbounded.Unbounded_String)
Encode one complete representation. Implementations replace Output and raise Resource_Exhausted when their configured output bound is exceeded.
Parameters
- Item
Encoder
- Input
Unencoded representation
- Output
Encoded representation
Encoder
type Encoder is limited interface;
Caller-owned bounded response encoder.
Maximum_Input
function Maximum_Input (Item : Encoder) return Natural
Return the maximum accepted input size for one buffered transform.
Parameters
- Item
Encoder
Return value
Maximum input bytes