class Patron::Response

def parse_headers(header_data_for_multiple_responses)

Called by the C code to parse and set the headers
def parse_headers(header_data_for_multiple_responses)
  @headers = {}
  responses = Patron::HeaderParser.parse(header_data_for_multiple_responses)
  last_response = responses[-1] # Only use the last response (for proxies and redirects)
  @status_line = last_response.status_line
  last_response.headers.each do |line|
    hdr, val = line.split(":", 2)
    val.strip! unless val.nil?
    if @headers.key?(hdr)
      @headers[hdr] = [@headers[hdr]] unless @headers[hdr].kind_of? Array
      @headers[hdr] << val
    else
      @headers[hdr] = val
    end
  end
end