public function prepareRequest(Request $request)
	{
		$this->ch = curl_init();
		curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($this->ch, CURLOPT_HEADER, true);
		if ($auth = $request->getUserAndPass()) {
			curl_setopt($this->ch, CURLOPT_USERPWD, $auth);
		}
		curl_setopt($this->ch, CURLOPT_URL, $request->getUrl());

		$options = $request->getOptions();
		if (!empty($options)) {
			curl_setopt_array($this->ch, $options);
		}

		$method = $request->getMethod();
		curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, strtoupper($method));

		curl_setopt($this->ch, CURLOPT_HTTPHEADER, $request->formatHeaders());

		if ($request->hasData()) {
			curl_setopt($this->ch, CURLOPT_POSTFIELDS, $request->encodeData());
		}

		if ($method === 'head') {
			curl_setopt($this->ch, CURLOPT_NOBODY, true);
		}
	}