Class: Thin::Headers
Class Thin::Headers < Object
(in files lib/thin/headers.rb )Store HTTP header name-value pairs direcly to a string and allow duplicated entries on some names.
Includes
Methods
Public Class new()
[ show source ]
# File lib/thin/headers.rb, line 8
8: def initialize
9: @sent = {}
10: @out = []
11: end
Public Instance []=(key, value)
Add key: value pair to the headers. Ignore if already sent and no duplicates are allowed for this key.
[ show source ]
# 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
Public Instance has_key?(key)
[ show source ]
# File lib/thin/headers.rb, line 31
31: def has_key?(key)
32: @sent[key]
33: end
Public Instance to_s()
[ show source ]
# File lib/thin/headers.rb, line 35
35: def to_s
36: @out.join
37: end