Index: wp-includes/default-filters.php
===================================================================
--- wp-includes/default-filters.php	(revision 6316)
+++ wp-includes/default-filters.php	(working copy)
@@ -134,6 +134,9 @@
 add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
 add_filter('comment_email', 'antispambot');
 
+//Atom SSL support
+add_filter('atom_service_url','atom_service_url_filter');
+
 // Actions
 add_action('wp_head', 'rsd_link');
 add_action('wp_head', 'wlwmanifest_link');
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 6316)
+++ wp-includes/functions.php	(working copy)
@@ -1484,4 +1484,36 @@
 	return abs( intval( $maybeint ) );
 }
 
-?>
\ No newline at end of file
+/**
+ * Determines if the blog can be accessed over SSL
+ * @return bool whether of not SSL access is available
+ */
+function url_is_accessable_via_ssl($url)
+{
+	if (in_array('curl', get_loaded_extensions())) {
+		 $ssl = preg_replace( '/^http:\/\//', 'https://',  $url );
+
+		 $ch = curl_init();
+		 curl_setopt($ch, CURLOPT_URL, $ssl);
+		 curl_setopt($ch, CURLOPT_FAILONERROR, true);
+		 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+		 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+
+		 $data = curl_exec ($ch);
+
+		 $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+		 curl_close ($ch);
+
+		 if ($status == 200 || $status == 401) {
+			 return true;
+		 }
+	}
+	return false;
+}
+
+function atom_service_url_filter($url)
+{
+	if ( url_is_accessable_via_ssl($url) )
+		return  preg_replace( '/^http:\/\//', 'https://',  $url );
+}
+?>
Index: wp-app.php
===================================================================
--- wp-app.php	(revision 6316)
+++ wp-app.php	(working copy)
@@ -68,7 +68,6 @@
 	var $MEDIA_SINGLE_PATH = "attachment";
 
 	var $params = array();
-	var $script_name = "wp-app.php";
 	var $media_content_types = array('image/*','audio/*','video/*');
 	var $atom_content_types = array('application/atom+xml');
 
@@ -80,6 +79,10 @@
 	function AtomServer() {
 
 		$this->script_name = array_pop(explode('/',$_SERVER['SCRIPT_NAME']));
+		$this->app_base = get_bloginfo('url') . '/' . $this->script_name . '/';
+		if ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) {
+			$this->app_base = preg_replace( '/^http:\/\//', 'https://', $this->app_base );
+		}
 
 		$this->selectors = array(
 			'@/service$@' =>
@@ -594,7 +597,7 @@
 		} else {
 			$path = $this->ENTRIES_PATH;
 		}
-		$url = get_bloginfo('url') . '/' . $this->script_name . '/' . $path;
+		$url = $this->app_base . $path;
 		if(isset($page) && is_int($page)) {
 			$url .= "/$page";
 		}
@@ -607,7 +610,7 @@
 	}
 
 	function get_categories_url($page = NULL) {
-		return get_bloginfo('url') . '/' . $this->script_name . '/' . $this->CATEGORIES_PATH;
+		return $this->app_base . $this->CATEGORIES_PATH;
 	}
 
 	function the_categories_url() {
@@ -616,7 +619,7 @@
 	}
 
 	function get_attachments_url($page = NULL) {
-		$url = get_bloginfo('url') . '/' . $this->script_name . '/' . $this->MEDIA_PATH;
+		$url = $this->app_base . $this->MEDIA_PATH;
 		if(isset($page) && is_int($page)) {
 			$url .= "/$page";
 		}
@@ -629,7 +632,7 @@
 	}
 
 	function get_service_url() {
-		return get_bloginfo('url') . '/' . $this->script_name . '/' . $this->SERVICE_PATH;
+		return $this->app_base . $this->SERVICE_PATH;
 	}
 
 	function get_entry_url($postID = NULL) {
@@ -638,7 +641,7 @@
 			$postID = (int) $GLOBALS['post']->ID;
 		}
 
-		$url = get_bloginfo('url') . '/' . $this->script_name . '/' . $this->ENTRY_PATH . "/$postID";
+		$url = $this->app_base . $this->ENTRY_PATH . "/$postID";
 
 		log_app('function',"get_entry_url() = $url");
 		return $url;
@@ -655,7 +658,7 @@
 			$postID = (int) $GLOBALS['post']->ID;
 		}
 
-		$url = get_bloginfo('url') . '/' . $this->script_name . '/' . $this->MEDIA_SINGLE_PATH ."/file/$postID";
+		$url = $this->app_base . $this->MEDIA_SINGLE_PATH ."/file/$postID";
 
 		log_app('function',"get_media_url() = $url");
 		return $url;
@@ -919,7 +922,7 @@
 				$ctloc = $this->get_entry_url($post_ID);
 				break;
 			case 'attachment':
-				$edit = get_bloginfo('url') . '/' . $this->script_name . "/attachments/$post_ID";
+				$edit = $this->app_base . "attachments/$post_ID";
 				break;
 		}
 		header("Content-Type: $this->ATOM_CONTENT_TYPE");
Index: xmlrpc.php
===================================================================
--- xmlrpc.php	(revision 6316)
+++ xmlrpc.php	(working copy)
@@ -19,7 +19,6 @@
 
 if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd
 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
-
 ?>
 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
@@ -32,7 +31,7 @@
       <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
       <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
       <api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
-      <api name="Atom" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/wp-app.php/service" /> 
+      <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', (get_bloginfo('url')."/wp-app.php/service"))?>" /> 
     </apis>
   </service>
 </rsd>

