# File lib/ftw/webserver.rb, line 73
  def handle_request(request, connection)
    response = FTW::Response.new
    response.version = request.version
    response["Connection"] = request.headers["Connection"] || "close"

    # Process this request with the handler
    @handler.call(request, response, connection)

    # Write the response
    begin
      connection.write(response.to_s + CRLF)
      if response.body?
        write_http_body(response.body, connection,
                        response["Transfer-Encoding"] == "chunked") 
      end
    rescue => e
      @logger.error(e)
      connection.disconnect(e.inspect)
    end

    if response["Connection"] == "close" or response["Connection"].nil?
      connection.disconnect("'Connection' header was close or nil")
    end
  end