Common Gateway Interface (CGI) utility procedures.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | CGI_MAX_PARAMS | = | 32 |
Maximum number of CGI parameters. |
integer, | public, | parameter | :: | CGI_PARAM_LEN | = | 512 |
Maximum length of CGI parameter key, value. |
Generic interface to CGI get functions.
Returns (last) value associated with key in param
as 32-bit integer.
The return code is set to E_EMPTY
if the key does not exist and
required
has not been passed or is .true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
||
character(len=*), | intent(in) | :: | key |
Parameter key. |
||
integer(kind=i4), | intent(out) | :: | value |
Parameter value. |
||
integer(kind=i4), | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(in), | optional | :: | required |
Required flag. |
Returns (last) value associated with key in param
as 64-bit
integer. The return code is set to E_EMPTY
if the key does not
exist and required
has not been passed or is .true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameters. |
||
character(len=*), | intent(in) | :: | key |
Parameter key. |
||
integer(kind=i8), | intent(out) | :: | value |
Parameter value. |
||
integer(kind=i8), | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(in), | optional | :: | required |
Required flag. |
Returns (last) value associated with key in param
as logical. The
return code is set to E_EMPTY
if the key does not exist and
required
has not been passed or is .true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
||
character(len=*), | intent(in) | :: | key |
Parameter key. |
||
logical, | intent(out) | :: | value |
Parameter value. |
||
logical, | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(in), | optional | :: | required |
Required flag. |
Returns (last) value associated with key in param
as 32-bit real.
The return code is set to E_EMPTY
if the key does not exist and
required
has not been passed or is .true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
||
character(len=*), | intent(in) | :: | key |
Parameter key. |
||
real(kind=r4), | intent(out) | :: | value |
Parameter value. |
||
real(kind=r4), | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(in), | optional | :: | required |
Required flag. |
Returns (last) value associated with key in param
as 64-bit real.
The return code is set to E_EMPTY
if the key does not exist and
required
has not been passed or is .true.
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
||
character(len=*), | intent(in) | :: | key |
Parameter key. |
||
real(kind=r8), | intent(out) | :: | value |
Parameter value. |
||
real(kind=r8), | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(in), | optional | :: | required |
Required flag. |
Returns (last) value associated with key in param
. The return code
is set to E_EMPTY
if the key does not exist and required
has not
been passed or is .true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
||
character(len=*), | intent(in) | :: | key |
Parameter key. |
||
character(len=*), | intent(inout) | :: | value |
Parameter value. |
||
character(len=*), | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(in), | optional | :: | required |
Required flag. |
CGI environment variables type. Changes to this type have to be
regarded in subroutine dm_html_cgi_env()
.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=16), | public | :: | auth_type | = | ' ' |
AUTH_TYPE |
|
integer(kind=i8), | public | :: | content_length | = | 0_i8 |
CONTENT_LENGTH |
|
character(len=128), | public | :: | content_type | = | ' ' |
CONTENT_TYPE |
|
character(len=512), | public | :: | document_root | = | ' ' |
DOCUMENT_ROOT |
|
character(len=8), | public | :: | gateway_interface | = | ' ' |
GATEWAY_INTERFACE |
|
character(len=512), | public | :: | http_accept | = | ' ' |
HTTP_ACCEPT |
|
character(len=16), | public | :: | http_content_encoding | = | ' ' |
HTTP_CONTENT_ENCODING |
|
character(len=512), | public | :: | http_cookie | = | ' ' |
HTTP_COOKIE |
|
character(len=128), | public | :: | http_from | = | ' ' |
HTTP_FROM |
|
character(len=512), | public | :: | http_referer | = | ' ' |
HTTP_REFERER |
|
character(len=512), | public | :: | http_user_agent | = | ' ' |
HTTP_USER_AGENT |
|
character(len=512), | public | :: | path_info | = | ' ' |
PATH_INFO |
|
character(len=512), | public | :: | path_translated | = | ' ' |
PATH_TRANSLATED |
|
character(len=512), | public | :: | query_string | = | ' ' |
QUERY_STRING |
|
character(len=32), | public | :: | remote_addr | = | ' ' |
REMOTE_ADDR |
|
character(len=512), | public | :: | remote_host | = | ' ' |
REMOTE_HOST |
|
character(len=128), | public | :: | remote_ident | = | ' ' |
REMOTE_IDENT |
|
character(len=128), | public | :: | remote_user | = | ' ' |
REMOTE_USER |
|
character(len=8), | public | :: | request_method | = | ' ' |
REQUEST_METHOD |
|
character(len=512), | public | :: | request_uri | = | ' ' |
REQUEST_URI |
|
character(len=512), | public | :: | script_name | = | ' ' |
SCRIPT_NAME |
|
character(len=128), | public | :: | server_name | = | ' ' |
SERVER_NAME |
|
integer, | public | :: | server_port | = | 0 |
SERVER_PORT |
|
character(len=32), | public | :: | server_protocol | = | ' ' |
SERVER_PROTOCOL |
|
character(len=32), | public | :: | server_software | = | ' ' |
SERVER_SOFTWARE |
Opaque CGI parameter type. Stores GET and POST parameters as key-value pairs.
Returns .true.
if CGI environment variable AUTH
is set to
Basic
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_env_type), | intent(inout) | :: | env |
CGI environment type. |
Reads HTTP request body (POST method). We have to rely on read(2)
as Fortran cannot read unformatted content from standard input. On
error, the string content
is allocated but empty.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_env_type), | intent(inout) | :: | env |
CGI environment type. |
||
character(len=:), | intent(out), | allocatable, target | :: | content |
Returned request body. |
Unwinds percent-encoding in given input string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | input |
Encoded input string. |
||
character(len=len), | intent(out) | :: | output |
Decoded output string. |
Returns whether key exists in param
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
||
character(len=*), | intent(in) | :: | key |
Parameter key. |
Returns whether key exists in param
and has value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
||
character(len=*), | intent(in) | :: | key |
Parameter key. |
Returns key at index loc
in keys array of param
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
||
integer, | intent(in) | :: | loc |
Array index. |
Key or empty.
Returns the current number of elements in the given (opaque) CGI parameter type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
Returns value at index loc
in values array of param
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_param_type), | intent(inout) | :: | param |
CGI parameter type. |
||
integer, | intent(in) | :: | loc |
Array index. |
Value or empty.
Reads CGI environment variables and writes values into env
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_env_type), | intent(out) | :: | env |
CGI environment type. |
Returns HTTP form data from standard input
(application/x-www-form-urlencoded
).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_env_type), | intent(inout) | :: | env |
CGI environment type. |
||
type(cgi_param_type), | intent(out) | :: | param |
CGI parameter type. |
Writes HTTP header. A sane HTTP server converts the status code passed in the header to a real HTTP status code, as we cannot return it in any other way with CGI. Default HTTP status is 200.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | content_type |
MIME type. |
||
integer, | intent(in), | optional | :: | http_status |
HTTP status code. |
|
character(len=*), | intent(in), | optional | :: | location |
Optional redirect. |
Prints content to standard output, returning it to the web server.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | content |
Response content. |
Decodes and parses given character string containing new-line
separated key-values pairs, and returns CGI parameters in param
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
Input string. |
||
type(cgi_param_type), | intent(out) | :: | param |
CGI parameter type. |
Returns CGI GET parameters from environment variable QUERY_STRING
as key–value pairs in param
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cgi_env_type), | intent(inout) | :: | env |
CGI environment type. |
||
type(cgi_param_type), | intent(out) | :: | param |
CGI parameter type. |