|
NAMENet::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); $header = 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($app_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, $app_status, $protocol_status); # FCGI_UnknownTypeRecord $octets = build_unknown_type_record($type); # FCGI_NameValuePair's $octets = build_params($params); $params = parse_params($octets); $bool = check_params($octets); # FCGI_Record $octets = build_record($type, $request_id); $octets = build_record($type, $request_id, $content); @values = parse_record($octets); $record = parse_record($octets); $record = parse_record_body($type, $request_id, $content); # FCGI_Record Debugging / Tracing $string = dump_record($octets); $string = dump_record_body($type, $request_id, $content); # FCGI_Record Stream $octets = build_stream($type, $request_id, $content); $octets = build_stream($type, $request_id, $content, $terminate); # Begin Request $octets = build_begin_request($request_id, $role, $flags, $params); $octets = build_begin_request($request_id, $role, $flags, $params, $stdin); $octets = build_begin_request($request_id, $role, $flags, $params, $stdin, $data); # End Request $octets = build_end_request($request_id, $app_status, $protocol_status); $octets = build_end_request($request_id, $app_status, $protocol_status, $stdout); $octets = build_end_request($request_id, $app_status, $protocol_status, $stdout, $stderr); DESCRIPTIONProvides functions to build and parse FastCGI messages.FUNCTIONSPlease note that all functions in this package expects octets, not unicode strings. It's the callers responsibility to ensure this. If any of theese functions is called with unicode strings containing code points above 255, they will most likely produce malformed messages.build_begin_requestBuilds a Begin Request message.Usage $octets = build_begin_request($request_id, $role, $flags, $params); $octets = build_begin_request($request_id, $role, $flags, $params, $stdin); $octets = build_begin_request($request_id, $role, $flags, $params, $stdin, $data); Arguments
Returns
build_begin_request_bodyBuilds a "FCGI_BeginRequestBody".Usage $octets = build_begin_request_body($role, $flags); Arguments
Returns
build_begin_request_recordBuilds a "FCGI_BeginRequestRecord".Usage $octets = build_begin_request_record($request_id, $role, $flags); Arguments
Returns
build_end_requestBuilds a End Request messageUsage $octets = build_end_request($request_id, $app_status, $protocol_status); $octets = build_end_request($request_id, $app_status, $protocol_status, $stdout); $octets = build_end_request($request_id, $app_status, $protocol_status, $stdout, $stderr); Arguments
Returns
Note This function is equivalent to "build_end_request_record()" if called without $stdout and $stderr. build_end_request_bodyBuilds a "FCGI_EndRequestBody".Usage $octets = build_end_request_body($app_status, $protocol_status); Arguments
Returns
build_end_request_recordBuilds a "FCGI_EndRequestRecord".Usage $octets = build_end_request_record($request_id, $app_status, $protocol_status); Arguments
Returns
build_headerBuilds a "FCGI_Header".Usage $octets = build_header($type, $request_id, $content_length, $padding_length); Arguments
Returns
build_paramsBuilds "FCGI_NameValuePair"'s.Usage $octets = build_params($params); Arguments
Returns
build_recordBuilds a "FCGI_Record".Usage $octets = build_record($type, $request_id); $octets = build_record($type, $request_id, $content); Arguments
Returns
Note Follows the recommendation in specification and pads the record by 8-(content_length mod 8) zero-octets. build_streamBuilds a series of stream records.Usage $octets = build_stream($type, $request_id, $content); $octets = build_stream($type, $request_id, $content, $terminate); Arguments
Returns
Note Stream is not terminated if $content is empty unless $terminate is set. $content is split in segment sizes of 32760 octets (32768 - FCGI_HEADER_LEN). build_unknown_type_bodyBuilds a "FCGI_UnknownTypeBody".Usage $octets = build_unknown_type_body($type); Arguments
Returns
build_unknown_type_recordBuilds a "FCGI_UnknownTypRecord".Usage $octets = build_unknown_type_record($type); Arguments
Returns
check_paramsDetermine wheter or not params is well-formed.Usage $boolean = check_params($octets); Arguments
Returns
dump_recordDump a "FCGI_Record".Usage $string = dump_record($octets); Arguments
Returns
dump_record_bodyDump a "FCGI_Record".Usage $string = dump_record_body($type, $request_id); $string = dump_record_body($type, $request_id, $content); Arguments
Returns
parse_begin_request_bodyParses a "FCGI_BeginRequestBody".Usage ($role, $flags) = parse_begin_request_body($octets); Arguments
Returns
parse_end_request_bodyParses a "FCGI_EndRequestBody".Usage ($app_status, $protocol_status) = parse_end_request_body($octets); Arguments
Returns
parse_headerParses a "FCGI_Header".Usage ($type, $request_id, $content_length, $padding_length) = parse_header($octets); $header = parse_header($octets); say $header->{type}; say $header->{request_id}; say $header->{content_length}; say $header->{padding_length}; Arguments
Returns In list context:
In scalar context a hash reference containing above variable names as keys. parse_paramsParses "FCGI_NameValuePair"'s.Usage $params = parse_params($octets); Arguments
Returns
parse_recordParses a "FCGI_Record".Usage ($type, $request_id, $content) = parse_record($octets); $record = parse_record($octets); say $record->{type}; say $record->{request_id}; Arguments
Returns In list context:
In scalar context a hash reference containing the "FCGI_Record" components. See "parse_record_body". parse_record_bodyParses a "FCGI_Record".Usage $record = parse_record_body($type, $request_id, $content); say $record->{type}; say $record->{request_id}; Arguments
Returns A hash reference which represents the "FCGI_Record". The content depends on the type of record. All record types have the keys: "type" and "request_id".
parse_unknown_type_bodyParses a "FCGI_UnknownTypeBody".Usage $type = parse_unknown_type_body($octets); Arguments
Returns
get_record_lengthUsage$length = get_record_length($octets); Arguments
Returns
get_type_nameUsage$name = get_type_name($type); $name = get_type_name(FCGI_BEGIN_REQUEST); # 'FCGI_BEGIN_REQUEST' $name = get_type_name(255); # '0xFF' Arguments
Returns
Note See also ":name" in Net::FastCGI::Constant. get_role_nameUsage$name = get_role_name($type); $name = get_role_name(FCGI_RESPONDER); # 'FCGI_RESPONDER' $name = get_role_name(65535); # '0xFFFF' Arguments
Returns
Note See also ":name" in Net::FastCGI::Constant. get_protocol_status_nameUsage$name = get_protocol_status_name($protocol_status); $name = get_protocol_status_name(FCGI_REQUEST_COMPLETE); # 'FCGI_REQUEST_COMPLETE' $name = get_protocol_status_name(255); # '0xFF' Arguments
Returns
Note See also ":name" in Net::FastCGI::Constant. is_known_typeUsage$boolean = is_known_type($type); Arguments
Returns
is_management_typeUsage$boolean = is_management_type($type); Arguments
Returns
is_discrete_typeUsage$boolean = is_discrete_type($type); Arguments
Returns
is_stream_typeUsage$boolean = is_stream_type($type); Arguments
Returns
EXPORTSNone by default. All functions can be exported using the ":all" tag or individually.DIAGNOSTICS
SEE ALSO
AUTHORChristian Hansen "chansen@cpan.org"COPYRIGHTCopyright 2008-2010 by Christian Hansen.This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |