Skip to content
Snippets Groups Projects
Commit 4234b51c authored by git's avatar git Committed by Eric Mckenna
Browse files

Issue #1380636 by gnucifer, emackn: Fixed Wrong response headers

reported on 3xx requests in function http_request_get().
parent 107d0cf1
No related branches found
No related tags found
No related merge requests found
......@@ -172,14 +172,15 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
)), curl_errno($download)
);
}
$header_size = curl_getinfo($download, CURLINFO_HEADER_SIZE);
$header = substr($data, 0, $header_size - 1);
$result->data = substr($data, $header_size);
$header_lines = preg_split("/\r\n|\n|\r/", $header);
$headers = preg_split("/(\r\n){2}/", $header);
$header_lines = preg_split("/\r\n|\n|\r/", end($headers));
$result->headers = array();
array_shift($header_lines); // skip HTTP response status
while ($line = trim(array_shift($header_lines))) {
list($header, $value) = explode(':', $line, 2);
// Normalize the headers.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment