diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-04-25 13:56:06 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-04-25 13:56:06 +0000 |
commit | e9946015c7cd235e1bc44c6c7b2edabbdb186b2f (patch) | |
tree | b982e8975842f8272cc4bfea96a601c91c507f36 /includes/common.inc | |
parent | 453d7c566e980a4940267769800f8a02517404b1 (diff) | |
download | brdo-e9946015c7cd235e1bc44c6c7b2edabbdb186b2f.tar.gz brdo-e9946015c7cd235e1bc44c6c7b2edabbdb186b2f.tar.bz2 |
- Patch #345591 by pwolanin, JacobSingh: drupal_http_request() should return the original status message and protocol.
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 13 |
1 files changed, 10 insertions, 3 deletions
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; |