Module: Net::HTTPHeader
- Included in:
- Riak::Util::Headers
- Defined in:
- lib/riak/util/headers.rb
Overview
Splits headers into < 8KB chunks
Instance Method Summary collapse
Instance Method Details
#each_capitalized ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/riak/util/headers.rb', line 6 def each_capitalized # 1.9 check respond_to?(:enum_for) and (block_given? or return enum_for(__method__)) @header.each do |k,v| base_length = "#{k}: \r\n".length values = v.map {|i| i.to_s.split(", ") }.flatten while !values.empty? current_line = "" while values.first && current_line.length + base_length + values.first.length + 2 < 8192 val = values.shift.strip current_line += current_line.empty? ? val : ", #{val}" end yield capitalize(k), current_line end end end |