request.rb
#Handles the rest of the client's request
Handles the rest of the client's request
Handles the rest of the client ' s request
def extract_headers(client)
    headers = Hash.new
    client.each_line do |line|
      break if line == "\r\n"
      array = line.gsub("\r\n","").split(/: /)
      key = array[0]
      value = array[1]
      headers["#{key.downcase}"] = "#{value}"
    end
    content_length = headers["content-length"].to_i
    if (content_length > 0)
      headers["content"] = extract_content(client, content_length)
    end
    puts headers
    headers
  end
def extract_headers ( client ) headers = Hash . new client . each_line do | line | break if line == "\r\n" array = line . gsub ( "\r\n" , "" ) . split ( / :  / ) key = array [ 0 ] value = array [ 1 ] headers [ "#{key.downcase}" ] = "#{value}" end content_length = headers [ "content-length" ] . to_i if ( content_length > 0 ) headers [ "content" ] = extract_content ( client , content_length ) end puts headers headers end
Handles the rest of the client's request
Handles the rest of the client ' s request
client
<not_specific>