- Patch #578470 by jbrauer, Gabor, Dries: XML-RPC error handling was incomplete.
parent
1bd038b09d
commit
404fcf299f
|
@ -427,6 +427,18 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
|
|||
// Parse the URL, and make sure we can handle the schema.
|
||||
$uri = parse_url($url);
|
||||
|
||||
if ($uri == FALSE) {
|
||||
$result->error = 'unable to parse URL';
|
||||
$result->code = -1001;
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (!isset($uri['scheme'])) {
|
||||
$result->error = 'missing schema';
|
||||
$result->code = -1002;
|
||||
return $result;
|
||||
}
|
||||
|
||||
switch ($uri['scheme']) {
|
||||
case 'http':
|
||||
$port = isset($uri['port']) ? $uri['port'] : 80;
|
||||
|
@ -441,6 +453,7 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
|
|||
break;
|
||||
default:
|
||||
$result->error = 'invalid schema '. $uri['scheme'];
|
||||
$result->code = -1003;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue