Parent

Thin::Headers

Store HTTP header name-value pairs direcly to a string and allow duplicated entries on some names.

Constants

HEADER_FORMAT
ALLOWED_DUPLICATES

Public Class Methods

new() click to toggle source
    # File lib/thin/headers.rb, line 8
 8:     def initialize
 9:       @sent = {}
10:       @out = []
11:     end

Public Instance Methods

[]=(key, value) click to toggle source

Add key: value pair to the headers. Ignore if already sent and no duplicates are allowed for this key.

    # File lib/thin/headers.rb, line 16
16:     def []=(key, value)
17:       if !@sent.has_key?(key) || ALLOWED_DUPLICATES.include?(key)
18:         @sent[key] = true
19:         value = case value
20:                 when Time
21:                   value.httpdate
22:                 when NilClass
23:                   return
24:                 else
25:                   value.to_s
26:                 end
27:         @out << HEADER_FORMAT % [key, value]
28:       end
29:     end
has_key?(key) click to toggle source
    # File lib/thin/headers.rb, line 31
31:     def has_key?(key)
32:       @sent[key]
33:     end
to_s() click to toggle source
    # File lib/thin/headers.rb, line 35
35:     def to_s
36:       @out.join
37:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.