Index: plugins/FeedsHTTPFetcher.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsHTTPFetcher.inc,v
retrieving revision 1.25
diff -u -p -r1.25 FeedsHTTPFetcher.inc
--- plugins/FeedsHTTPFetcher.inc	15 Sep 2010 19:40:57 -0000	1.25
+++ plugins/FeedsHTTPFetcher.inc	13 Jan 2011 01:31:57 -0000
@@ -150,10 +150,27 @@ class FeedsHTTPFetcher extends FeedsFetc
    * Override parent::sourceFormValidate().
    */
   public function sourceFormValidate(&$values) {
+    // '#' is used as the pattern delimiter to avoid excessive escaping
+    $patterns = array(
+      '#webcal://#',
+      '#feed://#',
+    );
+
+    $values['source'] = preg_replace($patterns, 'http://', $values['source']);
+    
+    // if there is no leading 'http://' or 'https://' add 'http://'
+    if (!preg_match('#^https?://#', $values['source'])) {
+      $values['source'] = 'http://' . $values['source'];
+    }
+
     if ($this->config['auto_detect_feeds']) {
-      feeds_include_library('http_request.inc', 'http_request');
-      if ($url = http_request_get_common_syndication($values['source'])) {
-        $values['source'] = $url;
+      try {
+        feeds_include_library('http_request.inc', 'http_request');
+        if ($url = http_request_get_common_syndication($values['source'])) {
+          $values['source'] = $url;
+        }
+      } catch (Exception $e) {
+        form_set_Error('source', t('The feed URL is invalid.'));
       }
     }
   }
