protected function createHeaders(RequestInterface $request, array $options)
	{
		$headers         = [];
		$request_headers = $request->getHeaders();

		foreach ($request_headers as $name => $values) {
			$header = strtoupper($name);

			// cURL does not support 'Expect-Continue', skip all 'EXPECT' headers
			if ($header === 'EXPECT') {
				continue;
			}

			if ($header === 'CONTENT-LENGTH') {
				if (array_key_exists(CURLOPT_POSTFIELDS, $options)) {
					$values = [strlen($options[CURLOPT_POSTFIELDS])];
				}
				// Force content length to '0' if body is empty
				else if (!array_key_exists(CURLOPT_READFUNCTION, $options)) {
					$values = [0];
				}
			}

			foreach ($values as $value) {
				$headers[] = $name.': '.$value;
			}
		}

		// Although cURL does not support 'Expect-Continue', it adds the 'Expect'
		// header by default, so we need to force 'Expect' to empty.
		$headers[] = 'Expect:';

		return $headers;
	}