summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2012-04-27 15:35:34 +0200
committerGábor Hojtsy <gabor@hojtsy.hu>2012-04-27 15:35:34 +0200
commit5e967f46c68de857593b1d4b70a60c08453cf2e2 (patch)
treee4e07c43ab23a39245ed33dca7fab24b4f102834
parentad35cfa86580c7dbbe61ecbdf7f63a7e80cc0b0e (diff)
downloaddrupal-5e967f46c68de857593b1d4b70a60c08453cf2e2.tar.gz
drupal-5e967f46c68de857593b1d4b70a60c08453cf2e2.zip
Issue #183435 by TR, gregmac: make drupal_http_request() more tolerant of faulty newlines in the response headers
-rw-r--r--includes/common.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index b36805fb3ec..7d0bf853939 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -580,8 +580,10 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
}
fclose($fp);
- // Parse response.
- list($split, $result->data) = explode("\r\n\r\n", $response, 2);
+ // Parse response headers from the response body.
+ // Be tolerant of malformed HTTP responses that separate header and body with
+ // \n\n or \r\r instead of \r\n\r\n. See http://drupal.org/node/183435
+ list($split, $result->data) = preg_split("/\r\n\r\n|\n\n|\r\r/", $response, 2);
$split = preg_split("/\r\n|\n|\r/", $split);
list($protocol, $code, $status_message) = explode(' ', trim(array_shift($split)), 3);