http_pair Module

This module contains the pair_type derived type, designed to store various details like headers, file information, form-data, and authentication details.


Uses

    • stdlib_ascii

Contents


Derived Types

type, public ::  pair_type

A derived type use to store a name-value pair.

Read more…

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: name

Name (key)

character(len=:), public, allocatable :: value

Value


Functions

public pure function get_pair_value(pair_arr, name) result(val)

The function retrieves the value associated with a specified name from the passed array of pair_type objects (i.e., pair_arr). The search for the name is case-insensitive. If the name is not found, the function returns an unallocated string. In the case of duplicate name entries in the pair_arr, the function returns the value of the first occurrence of the name.

Read more…

Arguments

Type IntentOptional Attributes Name
type(pair_type), intent(in) :: pair_arr(:)

The array in which we want to find a pair_type instance with its name attribute equal to the given name.

character(len=*), intent(in) :: name

The name to be searched in the pair_arr.

Return Value character(len=:), allocatable

Stores the value of the corresponding pair_type object whose name
attribute is equal to the given name.

public pure function pair_has_name(pair_arr, name)

Return .true. if there exists a pair_type object inside pair_arr with a name attribute equal to the provided name; otherwise, return .false.. HTTP pairs are case-insensitive, implying that values are converted to lowercase before the comparison is performed.

Read more…

Arguments

Type IntentOptional Attributes Name
type(pair_type), intent(in) :: pair_arr(:)

The array in which we want to find a pair_type instance with its name attribute equal to the given name.

character(len=*), intent(in) :: name

The name to be searched in the pair_arr.

Return Value logical


Subroutines

public subroutine append_pair(pair, name, value)

Appends a new pair_type instance with the provided name and value into the given pair_type array(i.e pair).

Read more…

Arguments

Type IntentOptional Attributes Name
type(pair_type), intent(inout), allocatable :: pair(:)

An array of pair_type objects, to which a new instance of pair_type needs to be added.

character(len=*), intent(in) :: name

The name attribute of the pair_type to be added.

character(len=*), intent(in) :: value

The value attribute of the pair_type to be added.