Commit 318ac983 authored by Dries's avatar Dries

- Patch #137138 by jvandyk: fixed problem with drupal_http_request() not...

- Patch #137138 by jvandyk: fixed problem with drupal_http_request() not setting the proper error code when a network effect occurs.  Causes the XML-RPC backend to fail.
parent bcfc0e65
...@@ -431,7 +431,10 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = ...@@ -431,7 +431,10 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
// Make sure the socket opened properly. // Make sure the socket opened properly.
if (!$fp) { if (!$fp) {
$result->error = trim($errno .' '. $errstr); // When a network error occurs, we make sure that it is a negative
// number so it can clash with the HTTP status codes.
$result->code = -$errno;
$result->error = trim($errstr);
return $result; return $result;
} }
......
...@@ -440,7 +440,7 @@ function _xmlrpc() { ...@@ -440,7 +440,7 @@ function _xmlrpc() {
$xmlrpc_request = xmlrpc_request($method, $args); $xmlrpc_request = xmlrpc_request($method, $args);
$result = drupal_http_request($url, array("Content-Type" => "text/xml"), 'POST', $xmlrpc_request->xml); $result = drupal_http_request($url, array("Content-Type" => "text/xml"), 'POST', $xmlrpc_request->xml);
if ($result->code != 200) { if ($result->code != 200) {
xmlrpc_error(-$result->code, $result->error); xmlrpc_error($result->code, $result->error);
return FALSE; return FALSE;
} }
$message = xmlrpc_message($result->data); $message = xmlrpc_message($result->data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment