A derived type use to store a name-value pair.
It is used in many instances like:
Storing request and response
headers:
nameto represent the header name.valueto represent the header value.Representing fields in a url-encoded HTTP
form:
nameto represent the form field name.valueto represent the form field value.Storing information about the
fileto upload:
nameto represent the name of the file.valueto represent the path of the file on the local system.Storing authentication detail, require to authenticate the request.
nameto represent the usernamevalueto represent the password
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | name |
Name (key) |
||
| character(len=:), | public, | allocatable | :: | value |
Value |
type :: pair_type
!!> A derived type use to store a **name-value pair**.
!!>____
!!>It is used in many instances like:
!!>
!!>1. Storing request and response `headers`:
!!> - `name` to represent the header name.
!!> - `value` to represent the header value.
!!>
!!>2. Representing fields in a url-encoded **HTTP `form`**:
!!> - `name` to represent the form field name.
!!> - `value` to represent the form field value.
!!>
!!>3. Storing information about the `file` to upload:
!!> - `name` to represent the name of the file.
!!> - `value` to represent the path of the file on the local system.
!!>
!!>4. Storing authentication detail, require to authenticate the request.
!!> - `name` to represent the **username**
!!> - `value` to represent the **password**
character(:), allocatable :: name
!! Name (key)
character(:), allocatable :: value
!! Value
end type pair_type