- Patch #183435 by gregmac, TR: drupal_http_request() and malformed responses.

merge-requests/26/head
Dries Buytaert 2011-04-23 16:34:22 -04:00
parent 05e249e8f8
commit 9f9e9c3824
1 changed files with 3 additions and 1 deletions

View File

@ -914,7 +914,9 @@ function drupal_http_request($url, array $options = array()) {
return $result;
}
// Parse response headers from the response body.
list($response, $result->data) = explode("\r\n\r\n", $response, 2);
// Be tolerant of malformed HTTP responses that separate header and body with
// \n\n or \r\r instead of \r\n\r\n.
list($response, $result->data) = preg_split("/\r\n\r\n|\n\n|\r\r/", $response, 2);
$response = preg_split("/\r\n|\n|\r/", $response);
// Parse the response status line.