def set_header(name, value)
@closed and raise 'closed'
case (name.upcase)
when 'CONTENT-TYPE'
if (value =~ %r"^\S+/\S+") then
@options['type'] = $&
@options['type'].gsub!(/;$/, '')
end
if (value =~ %r'charset="([^"]+)"' || value =~ %r"charset=(\S+)") then
@options['charset'] = $1
end
when 'STATUS'
@options['status'] = value
when 'SERVER'
@options['server'] = value
when 'CONNECTION'
@options['connection'] = value
when 'CONTENT-LENGTH'
@options['length'] = value
when 'CONTENT-LANGUAGE'
@options['language'] = value
when 'EXPIRES'
@options['expires'] = value
when 'SET-COOKIE'
@options['cookie'] = value
else
@options[name] = value
end
nil
end