Apache HTTPD
Classes | Macros | Functions

Classes

struct  ap_fcgi_header
 A structure that represents the fixed header fields at the beginning of a "FastCGI record" (i.e., the data prior to content data and padding). More...
 
struct  ap_fcgi_begin_request_body
 This represents the content data of the FastCGI record when the type is AP_FCGI_BEGIN_REQUEST. More...
 

Macros

#define AP_FCGI_HEADER_LEN   8
 
#define AP_FCGI_MAX_CONTENT_LEN   65535
 
#define AP_FCGI_VERSION_1   1
 
#define AP_FCGI_BEGIN_REQUEST   1
 
#define AP_FCGI_ABORT_REQUEST   2
 
#define AP_FCGI_END_REQUEST   3
 
#define AP_FCGI_PARAMS   4
 
#define AP_FCGI_STDIN   5
 
#define AP_FCGI_STDOUT   6
 
#define AP_FCGI_STDERR   7
 
#define AP_FCGI_DATA   8
 
#define AP_FCGI_GET_VALUES   9
 
#define AP_FCGI_GET_VALUES_RESULT   10
 
#define AP_FCGI_UNKNOWN_TYPE   11
 
#define AP_FCGI_MAXTYPE   (AP_FCGI_UNKNOWN_TYPE)
 
#define AP_FCGI_HDR_VERSION_OFFSET   0
 
#define AP_FCGI_HDR_TYPE_OFFSET   1
 
#define AP_FCGI_HDR_REQUEST_ID_B1_OFFSET   2
 
#define AP_FCGI_HDR_REQUEST_ID_B0_OFFSET   3
 
#define AP_FCGI_HDR_CONTENT_LEN_B1_OFFSET   4
 
#define AP_FCGI_HDR_CONTENT_LEN_B0_OFFSET   5
 
#define AP_FCGI_HDR_PADDING_LEN_OFFSET   6
 
#define AP_FCGI_HDR_RESERVED_OFFSET   7
 
#define AP_FCGI_RESPONDER   1
 
#define AP_FCGI_AUTHORIZER   2
 
#define AP_FCGI_FILTER   3
 
#define AP_FCGI_KEEP_CONN   1 /* otherwise the application closes */
 
#define AP_FCGI_BRB_ROLEB1_OFFSET   0
 
#define AP_FCGI_BRB_ROLEB0_OFFSET   1
 
#define AP_FCGI_BRB_FLAGS_OFFSET   2
 
#define AP_FCGI_BRB_RESERVED0_OFFSET   3
 
#define AP_FCGI_BRB_RESERVED1_OFFSET   4
 
#define AP_FCGI_BRB_RESERVED2_OFFSET   5
 
#define AP_FCGI_BRB_RESERVED3_OFFSET   6
 
#define AP_FCGI_BRB_RESERVED4_OFFSET   7
 
#define AP_FCGI_RESPONDER_STR   "RESPONDER"
 
#define AP_FCGI_AUTHORIZER_STR   "AUTHORIZER"
 
#define AP_FCGI_FILTER_STR   "FILTER"
 
#define AP_FCGI_APACHE_ROLE_AUTHENTICATOR_STR   "AUTHENTICATOR"
 
#define AP_FCGI_APACHE_ROLE_AUTHORIZER_STR   "AUTHORIZER"
 
#define AP_FCGI_APACHE_ROLE_ACCESS_CHECKER_STR   "ACCESS_CHECKER"
 

Functions

void ap_fcgi_header_to_array (ap_fcgi_header *h, unsigned char a[])
 
void ap_fcgi_header_from_array (ap_fcgi_header *h, unsigned char a[])
 
void ap_fcgi_header_fields_from_array (unsigned char *version, unsigned char *type, apr_uint16_t *request_id, apr_uint16_t *content_len, unsigned char *padding_len, unsigned char a[])
 
void ap_fcgi_begin_request_body_to_array (ap_fcgi_begin_request_body *h, unsigned char a[])
 
void ap_fcgi_fill_in_header (ap_fcgi_header *header, unsigned char type, apr_uint16_t request_id, apr_uint16_t content_len, unsigned char padding_len)
 
void ap_fcgi_fill_in_request_body (ap_fcgi_begin_request_body *brb, int role, unsigned char flags)
 
apr_size_t ap_fcgi_encoded_env_len (apr_table_t *env, apr_size_t maxlen, int *starting_elem)
 
apr_status_t ap_fcgi_encode_env (request_rec *r, apr_table_t *env, void *buffer, apr_size_t buflen, int *starting_elem)
 

Detailed Description

Macro Definition Documentation

◆ AP_FCGI_ABORT_REQUEST

#define AP_FCGI_ABORT_REQUEST   2

Definition at line 78 of file util_fcgi.h.

◆ AP_FCGI_APACHE_ROLE_ACCESS_CHECKER_STR

#define AP_FCGI_APACHE_ROLE_ACCESS_CHECKER_STR   "ACCESS_CHECKER"

Definition at line 273 of file util_fcgi.h.

◆ AP_FCGI_APACHE_ROLE_AUTHENTICATOR_STR

#define AP_FCGI_APACHE_ROLE_AUTHENTICATOR_STR   "AUTHENTICATOR"

FastCGI implementations that implement the AUTHORIZER role for Apache httpd and allow the application to participate in any of the Apache httpd AAA phases typically set the variable FCGI_APACHE_ROLE to one of these strings to indicate the specific AAA phase.

Definition at line 271 of file util_fcgi.h.

◆ AP_FCGI_APACHE_ROLE_AUTHORIZER_STR

#define AP_FCGI_APACHE_ROLE_AUTHORIZER_STR   "AUTHORIZER"

Definition at line 272 of file util_fcgi.h.

◆ AP_FCGI_AUTHORIZER

#define AP_FCGI_AUTHORIZER   2

Definition at line 126 of file util_fcgi.h.

◆ AP_FCGI_AUTHORIZER_STR

#define AP_FCGI_AUTHORIZER_STR   "AUTHORIZER"

Definition at line 261 of file util_fcgi.h.

◆ AP_FCGI_BEGIN_REQUEST

#define AP_FCGI_BEGIN_REQUEST   1

Possible values for the type field of ap_fcgi_header

Definition at line 77 of file util_fcgi.h.

◆ AP_FCGI_BRB_FLAGS_OFFSET

#define AP_FCGI_BRB_FLAGS_OFFSET   2

Definition at line 139 of file util_fcgi.h.

◆ AP_FCGI_BRB_RESERVED0_OFFSET

#define AP_FCGI_BRB_RESERVED0_OFFSET   3

Definition at line 140 of file util_fcgi.h.

◆ AP_FCGI_BRB_RESERVED1_OFFSET

#define AP_FCGI_BRB_RESERVED1_OFFSET   4

Definition at line 141 of file util_fcgi.h.

◆ AP_FCGI_BRB_RESERVED2_OFFSET

#define AP_FCGI_BRB_RESERVED2_OFFSET   5

Definition at line 142 of file util_fcgi.h.

◆ AP_FCGI_BRB_RESERVED3_OFFSET

#define AP_FCGI_BRB_RESERVED3_OFFSET   6

Definition at line 143 of file util_fcgi.h.

◆ AP_FCGI_BRB_RESERVED4_OFFSET

#define AP_FCGI_BRB_RESERVED4_OFFSET   7

Definition at line 144 of file util_fcgi.h.

◆ AP_FCGI_BRB_ROLEB0_OFFSET

#define AP_FCGI_BRB_ROLEB0_OFFSET   1

Definition at line 138 of file util_fcgi.h.

◆ AP_FCGI_BRB_ROLEB1_OFFSET

#define AP_FCGI_BRB_ROLEB1_OFFSET   0

Offsets of the various fields of ap_fcgi_begin_request_body

Definition at line 137 of file util_fcgi.h.

◆ AP_FCGI_DATA

#define AP_FCGI_DATA   8

Definition at line 84 of file util_fcgi.h.

◆ AP_FCGI_END_REQUEST

#define AP_FCGI_END_REQUEST   3

Definition at line 79 of file util_fcgi.h.

◆ AP_FCGI_FILTER

#define AP_FCGI_FILTER   3

Definition at line 127 of file util_fcgi.h.

◆ AP_FCGI_FILTER_STR

#define AP_FCGI_FILTER_STR   "FILTER"

Definition at line 262 of file util_fcgi.h.

◆ AP_FCGI_GET_VALUES

#define AP_FCGI_GET_VALUES   9

Definition at line 85 of file util_fcgi.h.

◆ AP_FCGI_GET_VALUES_RESULT

#define AP_FCGI_GET_VALUES_RESULT   10

Definition at line 86 of file util_fcgi.h.

◆ AP_FCGI_HDR_CONTENT_LEN_B0_OFFSET

#define AP_FCGI_HDR_CONTENT_LEN_B0_OFFSET   5

Definition at line 98 of file util_fcgi.h.

◆ AP_FCGI_HDR_CONTENT_LEN_B1_OFFSET

#define AP_FCGI_HDR_CONTENT_LEN_B1_OFFSET   4

Definition at line 97 of file util_fcgi.h.

◆ AP_FCGI_HDR_PADDING_LEN_OFFSET

#define AP_FCGI_HDR_PADDING_LEN_OFFSET   6

Definition at line 99 of file util_fcgi.h.

◆ AP_FCGI_HDR_REQUEST_ID_B0_OFFSET

#define AP_FCGI_HDR_REQUEST_ID_B0_OFFSET   3

Definition at line 96 of file util_fcgi.h.

◆ AP_FCGI_HDR_REQUEST_ID_B1_OFFSET

#define AP_FCGI_HDR_REQUEST_ID_B1_OFFSET   2

Definition at line 95 of file util_fcgi.h.

◆ AP_FCGI_HDR_RESERVED_OFFSET

#define AP_FCGI_HDR_RESERVED_OFFSET   7

Definition at line 100 of file util_fcgi.h.

◆ AP_FCGI_HDR_TYPE_OFFSET

#define AP_FCGI_HDR_TYPE_OFFSET   1

Definition at line 94 of file util_fcgi.h.

◆ AP_FCGI_HDR_VERSION_OFFSET

#define AP_FCGI_HDR_VERSION_OFFSET   0

Offsets of the various fields of ap_fcgi_header

Definition at line 93 of file util_fcgi.h.

◆ AP_FCGI_HEADER_LEN

#define AP_FCGI_HEADER_LEN   8

Definition at line 62 of file util_fcgi.h.

◆ AP_FCGI_KEEP_CONN

#define AP_FCGI_KEEP_CONN   1 /* otherwise the application closes */

Definition at line 132 of file util_fcgi.h.

◆ AP_FCGI_MAX_CONTENT_LEN

#define AP_FCGI_MAX_CONTENT_LEN   65535

Definition at line 67 of file util_fcgi.h.

◆ AP_FCGI_MAXTYPE

#define AP_FCGI_MAXTYPE   (AP_FCGI_UNKNOWN_TYPE)

Definition at line 88 of file util_fcgi.h.

◆ AP_FCGI_PARAMS

#define AP_FCGI_PARAMS   4

Definition at line 80 of file util_fcgi.h.

◆ AP_FCGI_RESPONDER

#define AP_FCGI_RESPONDER   1

Definition at line 125 of file util_fcgi.h.

◆ AP_FCGI_RESPONDER_STR

#define AP_FCGI_RESPONDER_STR   "RESPONDER"

String forms for the value of the FCGI_ROLE envvar

Definition at line 260 of file util_fcgi.h.

◆ AP_FCGI_STDERR

#define AP_FCGI_STDERR   7

Definition at line 83 of file util_fcgi.h.

◆ AP_FCGI_STDIN

#define AP_FCGI_STDIN   5

Definition at line 81 of file util_fcgi.h.

◆ AP_FCGI_STDOUT

#define AP_FCGI_STDOUT   6

Definition at line 82 of file util_fcgi.h.

◆ AP_FCGI_UNKNOWN_TYPE

#define AP_FCGI_UNKNOWN_TYPE   11

Definition at line 87 of file util_fcgi.h.

◆ AP_FCGI_VERSION_1

#define AP_FCGI_VERSION_1   1

Possible values for the version field of ap_fcgi_header

Definition at line 72 of file util_fcgi.h.

Function Documentation

◆ ap_fcgi_begin_request_body_to_array()

void ap_fcgi_begin_request_body_to_array ( ap_fcgi_begin_request_body h,
unsigned char  a[] 
)

Pack ap_fcgi_begin_request_body

Parameters
hThe begin-request body to read from
aThe array to write to, of size AP_FCGI_HEADER_LEN

Definition at line 68 of file util_fcgi.c.

◆ ap_fcgi_encode_env()

apr_status_t ap_fcgi_encode_env ( request_rec r,
apr_table_t env,
void *  buffer,
apr_size_t  buflen,
int starting_elem 
)

Encode the next portion of the provided environment table using a buffer previously allocated.

Parameters
rThe request, for logging
envThe environment table
bufferA buffer to contain the encoded environment table
buflenThe length of the buffer, previously computed by ap_fcgi_encoded_env_len().
starting_elemOn input, the next element of the table array to process in this FastCGI record. On output, the next element to process on the next FastCGI record.
Returns
APR_SUCCESS if a section could be encoded or APR_ENOSPC otherwise.
Note
The output starting_elem from ap_fcgi_encoded_env_len shouldn't be used as input to ap_fcgi_encode_env when building the same FastCGI record.

Definition at line 179 of file util_fcgi.c.

◆ ap_fcgi_encoded_env_len()

apr_size_t ap_fcgi_encoded_env_len ( apr_table_t env,
apr_size_t  maxlen,
int starting_elem 
)

Compute the buffer size needed to encode the next portion of the provided environment table.

Parameters
envThe environment table
maxlenThe maximum buffer size allowable, capped at AP_FCGI_MAX_CONTENT_LEN.
starting_elemOn input, the next element of the table array to process in this FastCGI record. On output, the next element to process on the next FastCGI record.
Returns
Size of buffer needed to encode the next part, or 0 if no more can be encoded. When 0 is returned: If starting_elem has reached the end of the table array, all has been encoded; otherwise, the next envvar can't be encoded within the specified limit.
Note
If an envvar can't be encoded within the specified limit, the caller can log a warning and increment starting_elem and try again or increase the limit or fail, as appropriate for the module.

Definition at line 116 of file util_fcgi.c.

◆ ap_fcgi_fill_in_header()

void ap_fcgi_fill_in_header ( ap_fcgi_header header,
unsigned char  type,
apr_uint16_t  request_id,
apr_uint16_t  content_len,
unsigned char  padding_len 
)

Fill in a FastCGI request header with the required field values.

Parameters
headerThe header to fill in
typeThe type of record
request_idThe request id
content_lenThe amount of content which follows the header
padding_lenThe amount of padding which follows the content

The header array must be at least AP_FCGI_HEADER_LEN bytes long.

Definition at line 81 of file util_fcgi.c.

◆ ap_fcgi_fill_in_request_body()

void ap_fcgi_fill_in_request_body ( ap_fcgi_begin_request_body brb,
int  role,
unsigned char  flags 
)

Fill in a FastCGI begin request body with the required field values.

Parameters
brbThe begin-request-body to fill in
roleAP_FCGI_RESPONDER or other roles
flags0 or a combination of flags like AP_FCGI_KEEP_CONN

Definition at line 102 of file util_fcgi.c.

◆ ap_fcgi_header_fields_from_array()

void ap_fcgi_header_fields_from_array ( unsigned char version,
unsigned char type,
apr_uint16_t request_id,
apr_uint16_t content_len,
unsigned char padding_len,
unsigned char  a[] 
)

Unpack header of FastCGI record into individual fields

Parameters
versionThe version, on output
typeThe type, on output
request_idThe request id, on output
content_lenThe content length, on output
padding_lenThe amount of padding following the content, on output
aThe array to read from, of size AP_FCGI_HEADER_LEN

Definition at line 52 of file util_fcgi.c.

◆ ap_fcgi_header_from_array()

void ap_fcgi_header_from_array ( ap_fcgi_header h,
unsigned char  a[] 
)

Unpack header of FastCGI record into ap_fcgi_header

Parameters
hThe header to write to
aThe array to read from, of size AP_FCGI_HEADER_LEN

Definition at line 39 of file util_fcgi.c.

◆ ap_fcgi_header_to_array()

void ap_fcgi_header_to_array ( ap_fcgi_header h,
unsigned char  a[] 
)

Pack ap_fcgi_header

Parameters
hThe header to read from
aThe array to write to, of size AP_FCGI_HEADER_LEN

Definition at line 26 of file util_fcgi.c.