Net::HTTPHeader Confusion

It appears Net::HTTPHeader conforms to the old cookie spec
(http://www.ietf.org/rfc/rfc2109.txt) and not the current one
(http://www.rfc-editor.org/rfc/rfc6265.txt) with regards to multiple
Set-Cookie header value folding.

The problem is explained in this SO question:
Adding multiple Set-Cookie Headers in ASP.NET Web - Stack Overflow.

Example:
require ‘net/http’

class Header
include Net::HTTPHeader

def initialize(header = {})
initialize_http_header(header)
end
end

h = Header.new
h.add_field(‘Set-Cookie’, ‘name=cookie1;’)
h.add_field(‘Set-Cookie’, ‘name=cookie2;’)
puts h[‘Set-Cookie’]

This code outputs “name=cookie1;, name=cookie2;” which is the old way of
folding two set-cookie header values into one. The current solution is
to send a Set-Cookie header for each cookie value you want set.