In Files

Parent

FCGI::ValuesRecord

Attributes

values[R]

Public Class Methods

new(type, id, values) click to toggle source
     # File lib/fcgi.rb, line 460
460:       def initialize(type, id, values)
461:         super type, id
462:         @values = values
463:       end
parse(id, body) click to toggle source
     # File lib/fcgi.rb, line 434
434:       def self::parse(id, body)
435:         new(id, parse_values(body))
436:       end
parse_values(buf) click to toggle source
     # File lib/fcgi.rb, line 438
438:       def self::parse_values(buf)
439:         result = {}
440:         until buf.empty?
441:           name, value = *read_pair(buf)
442:           result[name] = value
443:         end
444:         result
445:       end
read_length(buf) click to toggle source
     # File lib/fcgi.rb, line 453
453:       def self::read_length(buf)
454:         if buf[0] >> 7 == 0
455:         then buf.slice!(0,1)[0]
456:         else buf.slice!(0,4).unpack('N')[0] & ((1<<31) - 1)
457:         end
458:       end
read_pair(buf) click to toggle source
     # File lib/fcgi.rb, line 447
447:       def self::read_pair(buf)
448:         nlen = read_length(buf)
449:         vlen = read_length(buf)
450:         return buf.slice!(0, nlen), buf.slice!(0, vlen)
451:       end

Private Instance Methods

make_body() click to toggle source
     # File lib/fcgi.rb, line 469
469:       def make_body
470:         buf = ''
471:         @values.each do |name, value|
472:           buf << serialize_length(name.length)
473:           buf << serialize_length(value.length)
474:           buf << name
475:           buf << value
476:         end
477:         buf
478:       end
serialize_length(len) click to toggle source
     # File lib/fcgi.rb, line 480
480:       def serialize_length(len)
481:         if len < 0x80
482:         then len.chr
483:         else [len | (1<<31)].pack('N')
484:         end
485:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.