class Patron::Response

Represents the response from the HTTP server.

def initialize

def initialize
  @headers = {}
end

def inspect

def inspect
  # Avoid spamming the console with the header and body data
  "#<Patron::Response @status_line='#{@status_line}'>"
end

def parse_headers(header_data)

Called by the C code to parse and set the headers
def parse_headers(header_data)
  header_data.split(/\r\n/).each do |header|
    if header =~ %r|^HTTP/1.[01]|
      @status_line = header.strip
    else
      parts = header.split(':', 2)
      parts[1].strip! unless parts[1].nil?
      if @headers.has_key?(parts[0])
        @headers[parts[0]] << ",#{parts[1]}"
      else
        @headers[parts[0]] = parts[1]
      end
    end
  end
end