public function prepare(AbstractRequest $request)
    {
        $config = $request->getOptions();

        $this->options[CURLOPT_URL] = (string)$config->url;
        $this->options[CURLOPT_UPLOAD] = (bool)$config->upload;
        $this->options[CURLOPT_HTTPHEADER] = $request->getHeaderLines();

        if ($config instanceof Configuration\HttpConfiguration) {
            $this->prepareHttp($config);
        }
        if ($config instanceof Configuration\FtpConfiguration) {
            $this->options[CURLOPT_FTP_USE_EPSV] = $config->passive;
            $this->options[CURLOPT_QUOTE] = $config->commandsRequest();
            $this->options[CURLOPT_POSTQUOTE] = $config->commandsPost();
        }
        if ($config instanceof Configuration\SshConfiguration) {
            $this->options[CURLOPT_POSTQUOTE] = $config->commandsPost();
        }

        if ($config->hasBody()) {
            $body = $config->body;
            if (is_resource($body)) {
                $this->options[CURLOPT_INFILE] = $body;
                $md = stream_get_meta_data($body);
                $this->options[CURLOPT_INFILESIZE] = filesize($md['uri']);
            } else {
                $this->options[CURLOPT_POSTFIELDS] = $body;
            }
        } else {
            $this->options[CURLOPT_NOBODY] = true;
        }

        return $this;
    }