diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-08-12 08:36:38 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-08-12 08:36:38 +0000 |
commit | 89fffd242ae3696a784698ca58133706e06b474b (patch) | |
tree | e3c0f9553008a1128458ddaaf23bcd6e93ddae36 | |
parent | 73f98066f5920045f9a83108f7410155564af486 (diff) | |
download | brdo-89fffd242ae3696a784698ca58133706e06b474b.tar.gz brdo-89fffd242ae3696a784698ca58133706e06b474b.tar.bz2 |
- Patch #283806 by mustafau, Aron Noval: improved error handling in drupal_http_request().
-rw-r--r-- | includes/common.inc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc index b5a2b4bba..e791deca2 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -436,6 +436,16 @@ 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 (!isset($uri['scheme'])) { + $result->error = 'missing schema'; + return $result; + } + + if (!isset($uri['host'])) { + $result->error = 'missing host'; + return $result; + } + switch ($uri['scheme']) { case 'http': $port = isset($uri['port']) ? $uri['port'] : 80; |