Class: FCGI::Record
- Inherits:
-
Object
- Object
- FCGI::Record
- Defined in:
- lib/cgialt/fcgi/core.rb,
lib/cgialt/fcgi/core.rb
Overview
redefine
Direct Known Subclasses
AbortRequestRecord, BeginRequestRecord, EndRequestRecord, GenericDataRecord, UnknownTypeRecord, ValuesRecord
Constant Summary collapse
- HEADER_FORMAT =
uint8_t protocol_version; uint8_t record_type; uint16_t request_id; (big endian) uint16_t content_length; (big endian) uint8_t padding_length; uint8_t reserved;
'CCnnCC'- HEADER_LENGTH =
8- RECORD_CLASS =
{ FCGI_GET_VALUES => GetValuesRecord, FCGI_BEGIN_REQUEST => BeginRequestRecord, FCGI_ABORT_REQUEST => AbortRequestRecord, FCGI_PARAMS => ParamsRecord, FCGI_STDIN => StdinDataRecord, FCGI_DATA => DataRecord, FCGI_STDOUT => StdoutDataRecord, FCGI_END_REQUEST => EndRequestRecord }
Instance Attribute Summary collapse
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, reqid) ⇒ Record
constructor
A new instance of Record.
- #management_record? ⇒ Boolean
- #serialize ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(type, reqid) ⇒ Record
Returns a new instance of Record.
317 318 319 320 |
# File 'lib/cgialt/fcgi/core.rb', line 317 def initialize(type, reqid) @type = type @request_id = reqid end |
Instance Attribute Details
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
326 327 328 |
# File 'lib/cgialt/fcgi/core.rb', line 326 def request_id @request_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
326 327 328 |
# File 'lib/cgialt/fcgi/core.rb', line 326 def type @type end |
Class Method Details
.class_for(type) ⇒ Object
313 314 315 |
# File 'lib/cgialt/fcgi/core.rb', line 313 def self::class_for(type) RECORD_CLASS[type] end |
.parse_header(buf) ⇒ Object
309 310 311 |
# File 'lib/cgialt/fcgi/core.rb', line 309 def self::parse_header(buf) return *buf.unpack(HEADER_FORMAT) end |
Instance Method Details
#management_record? ⇒ Boolean
328 329 330 |
# File 'lib/cgialt/fcgi/core.rb', line 328 def management_record? @request_id == FCGI_NULL_REQUEST_ID end |
#serialize ⇒ Object
332 333 334 335 336 337 |
# File 'lib/cgialt/fcgi/core.rb', line 332 def serialize body = make_body() padding_length = body.length % 8 header = make_header(body.length, padding_length) "#{header}#{body}#{'\000' * padding_length}" end |
#version ⇒ Object
322 323 324 |
# File 'lib/cgialt/fcgi/core.rb', line 322 def version ::FCGI::ProtocolVersion end |