From 9f9e9c382479405f36c37a5448a2a5d4a4fcc6c9 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 23 Apr 2011 16:34:22 -0400 Subject: - Patch #183435 by gregmac, TR: drupal_http_request() and malformed responses. --- includes/common.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/common.inc b/includes/common.inc index 3eb76b48b..ca1976a32 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -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. -- cgit v1.2.3