Sha256: 462e9eb437eb82bb49596265f28671965e19564ae8c8ba9d7cea44a5bfc9975e
Contents?: true
Size: 691 Bytes
Versions: 2
Compression:
Stored size: 691 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thin-0.6.2-x86-mswin32-60 | lib/thin/headers.rb |
thin-0.6.2 | lib/thin/headers.rb |