+ /**
+ * Retrieves only the headers for an absolute path.
+ *
+ * Executes a cURL request without any modifications to the given URL.
+ * Note that Guzzle always normalizes URLs which prevents testing all
+ * possible edge cases.
+ *
+ * @param string $url
+ * URL to request.
+ *
+ * @return array
+ * Array of headers.
+ */
+ protected function getHeaders($url) {
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_HEADER, TRUE);
+ curl_setopt($ch, CURLOPT_NOBODY, TRUE);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+ curl_setopt($ch, CURLOPT_USERAGENT, drupal_generate_test_ua($this->databasePrefix));
+ $output = curl_exec($ch);
+ curl_close($ch);
+
+ $headers = [];
+ foreach (explode("\n", $output) as $header) {
+ if (strpos($header, ':')) {
+ list($key, $value) = explode(':', $header, 2);
+ $headers[trim($key)] = trim($value);
+ }
+ }
+
+ return $headers;
+ }
+