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.
318 319 320 321 |
# File 'lib/cgialt/fcgi/core.rb', line 318 def initialize(type, reqid) @type = type @request_id = reqid end |
Instance Attribute Details
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
328 329 330 |
# File 'lib/cgialt/fcgi/core.rb', line 328 def request_id @request_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
327 328 329 |
# File 'lib/cgialt/fcgi/core.rb', line 327 def type @type end |
Class Method Details
.class_for(type) ⇒ Object
314 315 316 |
# File 'lib/cgialt/fcgi/core.rb', line 314 def self::class_for(type) RECORD_CLASS[type] end |
.parse_header(buf) ⇒ Object
310 311 312 |
# File 'lib/cgialt/fcgi/core.rb', line 310 def self::parse_header(buf) return *buf.unpack(HEADER_FORMAT) end |
Instance Method Details
#management_record? ⇒ Boolean
330 331 332 |
# File 'lib/cgialt/fcgi/core.rb', line 330 def management_record? @request_id == FCGI_NULL_REQUEST_ID end |
#serialize ⇒ Object
334 335 336 337 338 339 |
# File 'lib/cgialt/fcgi/core.rb', line 334 def serialize body = make_body() padlen = body.length % 8 header = make_header(body.length, padlen) header + body + "\000" * padlen end |
#version ⇒ Object
323 324 325 |
# File 'lib/cgialt/fcgi/core.rb', line 323 def version ::FCGI::ProtocolVersion end |