class FCGI::Record

Constants

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;

HEADER_LENGTH
RECORD_CLASS

Attributes

request_id[R]
type[R]

Public Class Methods

class_for(type) click to toggle source
# File lib/fcgi.rb, line 318
def self.class_for(type)
  RECORD_CLASS[type]
end
new(type, reqid) click to toggle source
# File lib/fcgi.rb, line 322
def initialize(type, reqid)
  @type = type
  @request_id = reqid
end
parse_header(buf) click to toggle source
# File lib/fcgi.rb, line 314
def self.parse_header(buf)
  return *buf.unpack(HEADER_FORMAT)
end

Public Instance Methods

management_record?() click to toggle source
# File lib/fcgi.rb, line 334
def management_record?
  @request_id == FCGI_NULL_REQUEST_ID
end
serialize() click to toggle source
# File lib/fcgi.rb, line 338
def serialize
  body = make_body()
  padlen = body.length % 8
  header = make_header(body.length, padlen)
  header + body + "\000" * padlen
end
version() click to toggle source
# File lib/fcgi.rb, line 327
def version
  ::FCGI::ProtocolVersion
end

Private Instance Methods

make_header(clen, padlen) click to toggle source
# File lib/fcgi.rb, line 347
def make_header(clen, padlen)
  [version(), @type, @request_id, clen, padlen, 0].pack(HEADER_FORMAT)
end