# File lib/fcgi.rb, line 460 def initialize(type, id, values) super type, id @values = values end
# File lib/fcgi.rb, line 434 def self::parse(id, body) new(id, parse_values(body)) end
# 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
# 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
# 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