Sha256: d2849afa05da1616d61df9f2ac9be16e4892df1673e8fb4a1e3ab30e6eec1b93
Contents?: true
Size: 696 Bytes
Versions: 4
Compression:
Stored size: 696 Bytes
Contents
module Thin # Store HTTP header name-value pairs direcly to a string # and allow duplicated entries on some names. class Headers HEADER_FORMAT = "%s: %s\r\n".freeze ALLOWED_DUPLICATES = %w(Set-Cookie Set-Cookie2 Warning WWW-Authenticate).freeze def initialize @sent = {} @out = [] end # Add <tt>key: value</tt> pair to the headers. # Ignore if already sent and no duplicates are allowed # for this +key+. def []=(key, value) if !@sent.has_key?(key) || ALLOWED_DUPLICATES.include?(key) @sent[key] = true @out << HEADER_FORMAT % [key, value] end end def to_s @out.join end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
thin-0.6.3 | lib/thin/headers.rb |
thin-0.6.3-x86-mswin32-60 | lib/thin/headers.rb |
thin-0.6.4 | lib/thin/headers.rb |
thin-0.6.4-x86-mswin32-60 | lib/thin/headers.rb |