def perform_request(method, uri, options={})
      f = Fiber.current

      target_uri = endpoint + uri

      headers = {}
      unless options.fetch(:no_login, false)
        headers['authorization'] = auth_provider.auth_header
      end

      http = EM::HttpRequest.new(target_uri).send(method.to_sym, :head => headers)

      http.callback { f.resume(http) }
      http.errback  { f.resume(http) }

      Fiber.yield

    rescue URI::Error
      raise DirectorError, "Invalid URI: #{target_uri}"
    end
def perform_request(method, uri, options={})
      f = Fiber.current

      target_uri = endpoint + uri

      headers = {}
      unless options.fetch(:no_login, false)
        headers['authorization'] = auth_provider.auth_header
      end

      http = EM::HttpRequest.new(target_uri).send(method.to_sym, :head => headers)

      http.callback { f.resume(http) }
      http.errback  { f.resume(http) }

      Fiber.yield

    rescue URI::Error
      raise DirectorError, "Invalid URI: #{target_uri}"
    end
JMS and GO: This effectively turns async requests into synchronous requests.
 This is a very bad thing to do on eventmachine because it will block the single
 event loop. This code should be removed and all requests converted
 to "the eventmachine way".