← All compilation units

Flyology.HTTP

Description

Defines protocol concepts shared by Flyology HTTP clients and servers.

Host

function Host (Value : Origin) return String

Return the normalized DNS name or numeric address without IPv6 brackets.

Parameters
Value

Origin to inspect

Return value

Origin host

HTTP_1_1_Protocol

HTTP_1_1_Protocol : constant Protocol;

Negotiated HTTP/1.1 protocol.

HTTP_Version

type HTTP_Version is (HTTP_1_0, HTTP_1_1);

Parsed HTTP protocol version.

Enumeration literals
HTTP_1_0

HTTP/1.0 message

HTTP_1_1

HTTP/1.1 message

Image

function Image (Value : Method) return String

Return the exact method spelling.

Parameters
Value

Method to format

Return value

Original case-sensitive token

Image

function Image (Value : Origin) return String

Format the normalized origin, omitting a default port.

Parameters
Value

Origin to format

Return value

Absolute origin without a trailing slash

Image

function Image (Value : Protocol) return String

Return the conventional protocol spelling.

Parameters
Value

Protocol to format

Return value

Protocol name

Is_Idempotent

function Is_Idempotent (Value : Method) return Boolean

Report whether the standardized method has idempotent semantics. Unknown extension methods are conservatively classified as non-idempotent.

Parameters
Value

Method to classify

Return value

True for safe methods plus PUT and DELETE

Is_Safe

function Is_Safe (Value : Method) return Boolean

Report whether the standardized method has safe semantics. Unknown extension methods are conservatively classified as unsafe.

Parameters
Value

Method to classify

Return value

True for GET, HEAD, OPTIONS, or TRACE

Method

type Method is private;

Validated, case-sensitive HTTP method token. The representation is not an enumeration because HTTP permits extension methods.

Origin

type Origin is private;

Normalized HTTP origin containing only scheme, host, and port.

Origin_Scheme

type Origin_Scheme is (Plain_HTTP, Secure_HTTPS);

Scheme represented by an HTTP origin.

Enumeration literals
Plain_HTTP

Cleartext HTTP

Secure_HTTPS

HTTP over authenticated TLS

Parse_Origin

function Parse_Origin (Value : String) return Origin

Parse an absolute HTTP(S) origin. The input must not contain userinfo, a path other than one trailing slash, a query, or a fragment. DNS names are lower-cased; bracketed IPv6 literals retain their bracket-free spelling. Omitted ports become 80 or 443.

Parameters
Value

Absolute origin text

Return value

Parsed normalized origin

Raised exceptions
Constraint_Error

Value is not a supported HTTP(S) origin

Port

function Port (Value : Origin) return Port_Number

Return the effective origin port, including a scheme default.

Parameters
Value

Origin to inspect

Return value

TCP port

Port_Number

type Port_Number is range 1 .. 65_535;

Nonzero TCP port represented independently of socket implementation.

Protocol

type Protocol is private;

Opaque negotiated HTTP protocol. Constants can grow without exposing an enumeration that forces exhaustive downstream case statements.

Protocol_Error

Protocol_Error : exception;

Raised for malformed or unsupported HTTP protocol input.

Scheme

function Scheme (Value : Origin) return Origin_Scheme

Return the origin scheme.

Parameters
Value

Origin to inspect

Return value

Plain_HTTP or Secure_HTTPS

Status_Code

subtype Status_Code is Positive range 100 .. 599;

Three-digit HTTP status code.

To_Method

function To_Method (Value : String) return Method

Construct a method while preserving its exact wire spelling.

Parameters
Value

Nonempty HTTP token of at most 64 bytes

Return value

Validated method

Raised exceptions
Constraint_Error

Value is empty, oversized, or not a token