summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Drumm2009-09-16 17:29:09 (GMT)
committer Neil Drumm2009-09-16 17:29:09 (GMT)
commit404fcf299ff0cac27c1f12d9d2f417fccead87f0 (patch)
tree76b9d9cd3f726c3c6114b97eb655b1eb93b71ea8
parent1bd038b09dc7c834ced2e6221e8d232c3f3f7720 (diff)
- Patch #578470 by jbrauer, Gabor, Dries: XML-RPC error handling was incomplete.
-rw-r--r--includes/common.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 36a4346..a7f2674 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -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;
}