class FCGI::ValuesRecord

Attributes

values[R]

Public Class Methods

new(type, id, values) click to toggle source
Calls superclass method FCGI::Record::new
# File lib/fcgi.rb, line 460
def initialize(type, id, values)
  super type, id
  @values = values
end
parse(id, body) click to toggle source
# File lib/fcgi.rb, line 434
def self::parse(id, body)
  new(id, parse_values(body))
end
parse_values(buf) click to toggle source
# File lib/fcgi.rb, line 438
def self::parse_values(buf)
  result = {}
  until buf.empty?
    name, value = *read_pair(buf)
    result[name] = value
  end
  result
end
read_length(buf) click to toggle source
# File lib/fcgi.rb, line 453
def self::read_length(buf)
  if buf[0] >> 7 == 0
  then buf.slice!(0,1)[0]
  else buf.slice!(0,4).unpack('N')[0] & ((1<<31) - 1)
  end
end
read_pair(buf) click to toggle source
# File lib/fcgi.rb, line 447
def self::read_pair(buf)
  nlen = read_length(buf)
  vlen = read_length(buf)
  return buf.slice!(0, nlen), buf.slice!(0, vlen)
end