From 89fffd242ae3696a784698ca58133706e06b474b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 12 Aug 2008 08:36:38 +0000 Subject: - Patch #283806 by mustafau, Aron Noval: improved error handling in drupal_http_request(). --- includes/common.inc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'includes/common.inc') 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; -- cgit v1.2.3