NAME
Net::FastCGI::Protocol - Provides functions to build and parse FastCGI messages.
SYNOPSIS
# FCGI_Header
$octets = build_header($type, $request_id, $content_length, $padding_length);
@values = parse_header($octets);
# FCGI_BeginRequestBody
$octets = build_begin_request_body($role, $flags);
@values = parse_begin_request_body($octets);
# FCGI_EndRequestBody
$octets = build_end_request_body($application_status, $protocol_status);
@values = parse_end_request_body($octets);
# FCGI_UnknownTypeBody
$octets = build_unknown_type_body($type);
@values = parse_unknown_type_body($octets);
# FCGI_BeginRequestRecord
$octets = build_begin_request_record($request_id, $role, $flags);
# FCGI_EndRequestRecord
$octets = build_end_request_record($request_id, $application_status, $protocol_status);
# FCGI_UnknownTypeRecord
$octets = build_unknown_type_record($type);
# FCGI_Record
$octets = build_record($type, $request_id);
$octets = build_record($type, $request_id, $content);
# FCGI_NameValuePair's
$octets = build_params($params);
$params = parse_params($octets);
DESCRIPTION
Provides functions to build and parse FastCGI messages.
FUNCTIONS
build_begin_request_body
Builds a FCGI_BeginRequestBody
.
Usage
$octets = build_begin_request_body($role, $flags);
Arguments
Returns
build_begin_request_record
Builds a FCGI_BeginRequestRecord
.
Usage
$octets = build_begin_request_record($request_id, $role, $flags);
Arguments
$request_id
-
An unsigned 16-bit integer.
$role
-
An unsigned 16-bit integer.
$flags
-
An unsigned 8-bit integer.
Returns
build_end_request_body
Builds a FCGI_EndRequestBody
.
Usage
$octets = build_end_request_body($application_status, $protocol_status);
Arguments
Returns
build_end_request_record
Builds a FCGI_EndRequestRecord
.
Usage
$octets = build_end_request_record($request_id, $application_status, $protocol_status);
Arguments
$request_id
-
An unsigned 16-bit integer.
$application_status
-
An unsigned 32-bit integer.
$protocol_status
-
An unsigned 8-bit integer.
Returns
build_header
Builds a FCGI_Header
.
Usage
$octets = build_header($type, $request_id, $content_length, $padding_length);
Arguments
$type
-
An unsigned 8-bit integer.
$request_id
-
An unsigned 16-bit integer.
$content_length
-
An unsigned 16-bit integer.
$padding_length
-
An unsigned 8-bit integer.
Returns
build_padding
Usage
$octets = build_padding($padding_length);
Arguments
Returns
build_params
Builds FCGI_NameValuePair
's.
Usage
$octets = build_params($params);
Arguments
Returns
build_params_pair
Builds a FCGI_NameValuePair
.
Usage
$octets = build_params_pair($name, $value);
Arguments
Returns
build_params_pair_header
Builds FCGI_NameValuePair
header.
Usage
$octets = build_params_pair_header($name_length, $value_length);
Arguments
Returns
build_record
Builds a FCGI_Record
.
Usage
$octets = build_record($type, $request_id);
$octets = build_record($type, $request_id, $content);
Arguments
$type
-
An unsigned 8-bit integer.
$request_id
-
An unsigned 16-bit integer.
$content
(optional)-
A string of octets containing the content, must be less than or equal to 65535 octets in length.
Returns
build_unknown_type_body
Builds a FCGI_UnknownTypeBody
.
Usage
$octets = build_unknown_type_body($type);
Arguments
Returns
build_unknown_type_record
Builds a FCGI_UnknownTypRecord
.
Usage
$octets = build_unknown_type_record($type);
Arguments
Returns
parse_begin_request_body
Parses a FCGI_BeginRequestBody
.
Usage
($role, $flags) = parse_begin_request_body($octets);
Arguments
$octets
-
A string of octets containing the body, must be greater than or equal to 8 octets in length.
Returns
parse_end_request_body
Parses a FCGI_EndRequestBody
.
Usage
($application_status, $protocol_status) = parse_end_request_body($octets);
Arguments
$octets
-
A string of octets containing the body, must be greater than or equal to 8 octets in length.
Returns
parse_header
Parses a FCGI_Header
.
Usage
($type, $request_id, $content_length, $padding_length) = parse_header($octets);
Arguments
$octets
-
A string of octets containing the header, must be greater than or equal to 8 octets in length.
Returns
$type
-
An unsigned 8-bit integer.
$request_id
-
An unsigned 16-bit integer.
$content_length
-
An unsigned 16-bit integer.
$padding_length
-
An unsigned 8-bit integer.
parse_params
Parses FCGI_NameValuePair
's.
Usage
$params = parse_params($octets);
Arguments
Returns
parse_params_pair
Parses a FCGI_NameValuePair
.
Usage
($name, $value, $pair_length) = parse_params_pair($octets);
($name, $value, $pair_length) = parse_params_pair($octets, $offset);
Arguments
$octets
-
$octets
must be greater than or equal to 2 octets in length. $offset
(optional)-
An unsigned integer containing the offset in octets.
Returns
$name
-
Octets containing the name.
$value
-
Octets containing the value.
$pair_length
-
Length of
FCGI_NameValuePair
in octets.
parse_params_pair_header
Parses a FCGI_NameValuePair
header.
Usage
($name_length, $value_length, $header_length) = parse_params_pair_header($octets);
($name_length, $value_length, $header_length) = parse_params_pair_header($octets, $offset);
Arguments
$octets
-
$octets
must be greater than or equal to 2 octets in length. $offset
(optional)-
An unsigned integer containing the offset in octets.
Returns
$name_length
-
An unsigned 31-bit integer.
$value_length
-
An unsigned 31-bit integer.
$header_length
-
Length of
FCGI_NameValuePair
header in octets.
parse_unknown_type_body
Parses a FCGI_UnknownTypeBody
.
Usage
$type = parse_unknown_type_body($octets);
Arguments
Returns
compute_padding_length
Usage
$length = compute_padding_length($content_length);
Arguments
Returns
compute_params_length
Usage
$length = compute_params_length($params);
Arguments
Returns
compute_params_pair_length
Usage
$length = compute_params_pair_length($name, $value);
Arguments
Returns
compute_params_pair_header_length
Usage
$length = compute_params_pair_header_length($name_length, $value_length);
Arguments
Returns
compute_record_length
Usage
$length = compute_record_length($content_length);
Arguments
Returns
get_type_name
Usage
$name = get_type_name($type);
Arguments
Returns
get_role_name
Usage
$name = get_role_name($type);
Arguments
Returns
get_protocol_status_name
Usage
$name = get_protocol_status_name($protocol_status);
Arguments
Returns
is_known_type
Usage
$boolean = is_known_type($type);
Arguments
Returns
is_management_type
Usage
$boolean = is_management_type($type);
Arguments
Returns
is_discrete_type
Usage
$boolean = is_discrete_type($type);
Arguments
Returns
is_stream_type
Usage
$boolean = is_stream_type($type);
Arguments
Returns
EXPORTS
None by default. All functions can be exported using the :all
tag or individually.
DIAGNOSTICS
- (F) Usage: %s
- (F) Argument "%s" is not a hash reference
- (F) Argument "%s" is not an unsigned integer
- (F) Argument "%s" is not an unsigned %u-bit integer
- (F) Argument "%s" must be greater than or equal to %u octets in length
- (F) Argument "%s" must be less than or equal to %u octets in length
- (F) Argument "%s" is outside of octets length
- (F) Unexpected end of octets while parsing FCGI_NameValuePair header
- (F) Unexpected end of octets while parsing FCGI_NameValuePair name
- (F) Unexpected end of octets while parsing FCGI_NameValuePair value
- (F) Unsupported FastCGI version: %u
SEE ALSO
AUTHOR
Christian Hansen chansen@cpan.org
COPYRIGHT
Copyright (c) 2008 Christian Hansen. All rights reserved.
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.