diff --git a/includes/common.inc b/includes/common.inc index 3aa5f0282d82bc18f9c15eb11e9c481dce8b0d16..1da216095958db8a54d93defbf259c01b179b5b4 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -431,7 +431,10 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = // Make sure the socket opened properly. 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; } diff --git a/includes/xmlrpc.inc b/includes/xmlrpc.inc index f9e0886e248b505c7d7ae06734e2fa8e191941ff..c03b7b25c89b7fb8743650e78ebe027852c61022 100644 --- a/includes/xmlrpc.inc +++ b/includes/xmlrpc.inc @@ -440,7 +440,7 @@ function _xmlrpc() { $xmlrpc_request = xmlrpc_request($method, $args); $result = drupal_http_request($url, array("Content-Type" => "text/xml"), 'POST', $xmlrpc_request->xml); if ($result->code != 200) { - xmlrpc_error(-$result->code, $result->error); + xmlrpc_error($result->code, $result->error); return FALSE; } $message = xmlrpc_message($result->data);