Description
Stores validated HTTP fields in insertion order without combining repeated lines. The fixed field capacity and byte limit bound all retained storage.
Add
procedure Add (Item : in out List; Name : String; Value : String)
Append one physical field line. Names and values are validated against HTTP token and field-value syntax; repeated names remain separate.
Parameters
- Item
Collection to change
- Name
Case-insensitive field name whose spelling is preserved
- Value
Field value without surrounding line whitespace
Raised exceptions
- Constraint_Error
Name or Value is invalid
- Headers_Too_Large
A configured bound would be exceeded
Clear
procedure Clear (Item : in out List)
Remove every field line.
Parameters
- Item
Collection to clear
Count
function Count (Item : List) return Natural
Return the number of physical fields.
Parameters
- Item
Collection to inspect
Return value
Field count
Count
function Count (Item : List; Name : String) return Natural
Count physical occurrences of a case-insensitive field name.
Parameters
- Item
Collection to inspect
- Name
Field name
Return value
Matching physical field count
Default_Capacity
Default_Capacity : constant Positive := 64;
Default maximum number of physical fields retained by a list.
Default_Max_Bytes
Default_Max_Bytes : constant Positive := 16 * 1_024;
Default maximum combined field-name and field-value bytes.
Header_Byte_Limit
subtype Header_Byte_Limit is Positive range 1 .. 1_048_576;
Supported retained name/value byte bound.
Header_Capacity
subtype Header_Capacity is Positive range 1 .. 256;
Supported physical field-count bound.
Headers_Too_Large
Headers_Too_Large : exception;
Raised when a list cannot retain another field within its configured field-count or byte bound.
List
type List
(Capacity : Header_Capacity := Default_Capacity;
Max_Bytes : Header_Byte_Limit := Default_Max_Bytes) is private;
Ordered bounded collection of HTTP field lines.
Record fields
- Capacity
Maximum physical field count
- Max_Bytes
Maximum combined name and value bytes
Name
function Name (Item : List; Index : Positive) return String
Return one field name by insertion index.
Parameters
- Item
Collection to inspect
- Index
One-based physical field index
Return value
Preserved field name
Value
function Value (Item : List; Index : Positive) return String
Return one field value by insertion index.
Parameters
- Item
Collection to inspect
- Index
One-based physical field index
Return value
Preserved field value
Value
function Value
(Item : List; Name : String; Occurrence : Positive := 1) return String
Return one occurrence of a case-insensitive field. An empty string is returned when the occurrence is absent; use Count to distinguish that from a present empty value.
Parameters
- Item
Collection to inspect
- Name
Field name
- Occurrence
One-based matching occurrence
Return value
Matching value or an empty string