Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 2609)
+++ wp-includes/functions.php	(working copy)
@@ -679,7 +679,7 @@
 		$link_url = $matches[2][$i];
 		$link_text = $matches[4][$i];
 		$content = str_replace($link_match, $link_text.' '.$link_number, $content);
-		$link_url = (strtolower(substr($link_url,0,7)) != 'http://') ? get_settings('home') . $link_url : $link_url;
+		$link_url = ((strtolower(substr($link_url,0,7)) != 'http://')||(strtolower(substr($link_url,0,7)) != 'https://')) ? get_settings('home') . $link_url : $link_url;
 		$links_summary .= "\n".$link_number.' '.$link_url;
 	}
 	$content = strip_tags($content);
@@ -1843,4 +1843,4 @@
 	}	
 }
 
-?>
\ No newline at end of file
+?>
Index: xmlrpc.php
===================================================================
--- xmlrpc.php	(revision 2609)
+++ xmlrpc.php	(working copy)
@@ -283,7 +283,7 @@
 
 	  /* warning: here we make the assumption that the weblog's URI is on the same server */
 	  $filename = get_settings('home') . '/';
-	  $filename = preg_replace('#http://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
+	  $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
 
 	  $f = fopen($filename, 'r');
 	  $content = fread($f, filesize($filename));
@@ -317,7 +317,7 @@
 
 	  /* warning: here we make the assumption that the weblog's URI is on the same server */
 	  $filename = get_settings('home') . '/';
-	  $filename = preg_replace('#http://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
+	  $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
 
 	  if ($f = fopen($filename, 'w+')) {
 	    fwrite($f, $content);
@@ -1090,7 +1090,7 @@
 		$error_code = -1;
 
 		// Check if the page linked to is in our site
-		$pos1 = strpos($pagelinkedto, str_replace('http://', '', str_replace('www.', '', get_settings('home'))));
+		$pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_settings('home')));
 		if(!$pos1) {
 	  		return new IXR_Error(0, '');
 		}
@@ -1176,7 +1176,7 @@
 			preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
 		}
 		$pos2 = strpos($linea, $pagelinkedto);
-		$pos3 = strpos($linea, str_replace('http://www.', 'http://', $pagelinkedto));
+		$pos3 = strpos($linea, str_replace(array('http://www.','https://www.'), array('http://','https://'), $pagelinkedto));
 		if (is_integer($pos2) || is_integer($pos3)) {
 			// The page really links to us :)
 			$pos4 = (is_integer($pos2)) ? $pos2 : $pos3;
@@ -1270,4 +1270,4 @@
 
 $wp_xmlrpc_server = new wp_xmlrpc_server();
 
-?>
\ No newline at end of file
+?>
Index: wp-admin/install.php
===================================================================
--- wp-admin/install.php	(revision 2609)
+++ wp-admin/install.php	(working copy)
@@ -6,7 +6,8 @@
 require_once('../wp-config.php');
 require_once('./upgrade-functions.php');
 
-$guessurl = str_replace('/wp-admin/install.php?step=2', '', 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) );
+$schema = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'])=='on')?'https://':'http://';
+$guessurl = str_replace('/wp-admin/install.php?step=2', '', $schema . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) );
 
 if (isset($_GET['step']))
 	$step = $_GET['step'];
Index: wp-admin/upgrade-schema.php
===================================================================
--- wp-admin/upgrade-schema.php	(revision 2609)
+++ wp-admin/upgrade-schema.php	(working copy)
@@ -151,7 +151,8 @@
 function populate_options() {
 	global $wpdb;
 
-	$guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+	$schema = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'])=='on')?'https://':'http://';
+	$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
 	add_option('siteurl', $guessurl, __('WordPress web address'));
 	add_option('blogname', __('My Weblog'), __('Blog title'));
 	add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
