def request(verb, path, host, connect_options, request_options)
      # Finish forming path by stripping path, if any, from host
      uri = URI.parse(host)
      request_options[:path] = uri.path + request_options[:path]
      uri.path = ""

      # Make request an then yield fiber until it completes
      fiber = Fiber.current
      connection = EM::HttpRequest.new(uri.to_s, connect_options)
      # Store connection now so that close will get called if terminating or reconnecting
      c = @connections[path] = {:host => host, :connection => connection, :expires_at => Time.now} if request_options[:keepalive]
      http = connection.send(verb, request_options)
      http.errback { @connections.delete(path); fiber.resume(*handle_error(verb, http.error)) }
      http.callback { fiber.resume(http.response_header.status, http.response, http.response_header) }
      response_code, response_body, response_headers = Fiber.yield
      response_headers = beautify_headers(response_headers) if response_headers
      result = BalancedHttpClient.response(response_code, response_body, response_headers, request_options[:head][:accept])
      c[:expires_at] = Time.now + BalancedHttpClient::CONNECTION_REUSE_TIMEOUT if request_options[:keepalive]
      [result, response_code, response_body, response_headers]
    end
def request(verb, path, host, connect_options, request_options)
      # Finish forming path by stripping path, if any, from host
      uri = URI.parse(host)
      request_options[:path] = uri.path + request_options[:path]
      uri.path = ""

      # Make request an then yield fiber until it completes
      fiber = Fiber.current
      connection = EM::HttpRequest.new(uri.to_s, connect_options)
      # Store connection now so that close will get called if terminating or reconnecting
      c = @connections[path] = {:host => host, :connection => connection, :expires_at => Time.now} if request_options[:keepalive]
      http = connection.send(verb, request_options)
      http.errback { @connections.delete(path); fiber.resume(*handle_error(verb, http.error)) }
      http.callback { fiber.resume(http.response_header.status, http.response, http.response_header) }
      response_code, response_body, response_headers = Fiber.yield
      response_headers = beautify_headers(response_headers) if response_headers
      result = BalancedHttpClient.response(response_code, response_body, response_headers, request_options[:head][:accept])
      c[:expires_at] = Time.now + BalancedHttpClient::CONNECTION_REUSE_TIMEOUT if request_options[:keepalive]
      [result, response_code, response_body, response_headers]
    end
Make HTTP request
 Note that the underlying thread is not blocked by the HTTP i/o, but this call itself is blocking

 @param [Symbol] verb for HTTP REST request
 @param [String] path in URI for desired resource
 @param [String] host name of server
 @param [Hash] connect_options for HTTP connection
 @param [Hash] request_options for HTTP request

 @return [Array] result to be returned followed by response code, body, and headers

 @raise [HttpException] HTTP failure with associated status code