From e9946015c7cd235e1bc44c6c7b2edabbdb186b2f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 25 Apr 2009 13:56:06 +0000 Subject: - Patch #345591 by pwolanin, JacobSingh: drupal_http_request() should return the original status message and protocol. --- includes/common.inc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index ec1673585..6742e8ebe 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -426,12 +426,16 @@ function drupal_access_denied() { * - code * An integer containing the response status code, or the error code if * an error occurred. + * - protocol + * The response protocol (e.g. HTTP/1.1 or HTTP/1.0). + * - status_message + * The status message from the response, if a response was received. * - redirect_code * If redirected, an integer containing the initial response status code. * - redirect_url * If redirected, a string containing the redirection location. * - error - * If an error occurred, the error message. + * If an error occurred, the error message. Otherwise not set. * - headers * An array containing the response headers as name/value pairs. * - data @@ -550,7 +554,10 @@ function drupal_http_request($url, array $options = array()) { $response = preg_split("/\r\n|\n|\r/", $response); // Parse the response status line. - list($protocol, $code, $status) = explode(' ', trim(array_shift($response)), 3); + list($protocol, $code, $status_message) = explode(' ', trim(array_shift($response)), 3); + $result->protocol = $protocol; + $result->status_message = $status_message; + $result->headers = array(); // Parse the response headers. @@ -632,7 +639,7 @@ function drupal_http_request($url, array $options = array()) { $result->redirect_url = $location; break; default: - $result->error = $status; + $result->error = $status_message; } return $result; -- cgit v1.2.3