This module defines the
response_type
derived type, which represents an HTTP response from a web server.
Representing an HTTP response
.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | url |
The URL of the request |
||
character(len=:), | public, | allocatable | :: | content |
The content of the response. |
||
character(len=:), | public, | allocatable | :: | method |
The HTTP method of the request. |
||
character(len=:), | public, | allocatable | :: | err_msg |
The Error message if the response was not successful. |
||
integer, | public | :: | status_code | = | 0 |
The HTTP status code of the response |
|
integer(kind=int64), | public | :: | content_length | = | 0 |
length of the response content. |
|
logical, | public | :: | ok | = | .true. |
true if the response was successful else false. |
|
type(pair_type), | public, | allocatable | :: | header(:) |
An Array of response headers. |
procedure , public , :: header_value Function |
This function is used to retrieve the value
of a response header.
It takes the response header name
as input and returns the corresponding
header value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(response_type), | intent(in) | :: | this |
An object representing the HTTP response. |
||
character(len=*), | intent(in) | :: | name |
This refers to the name of the header for which we want to retrieve the value. |
This denotes the value of the specified header name.