diff --git a/gmap.module b/gmap.module
index 767d7cc..a99ce7d 100644
--- a/gmap.module
+++ b/gmap.module
@@ -325,7 +325,8 @@ drupal_add_js($gmap_path . '/js/poly.js');
     'key' => gmap_get_key(),
     'hl' => $language->language,
   );
-  drupal_set_html_head('<script src="'. check_url(url('http://maps.google.com/maps', array('query' => $query))) .'" type="text/javascript"></script>');
+  $protocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
+  drupal_set_html_head('<script src="'. check_url(url($protocol . '://maps.google.com/maps', array('query' => $query))) .'" type="text/javascript"></script>');
 
   $gmap_initialized = TRUE;
 }
@@ -1121,7 +1122,8 @@ function gmap_decimal($num) {
  */
 function gmap_geocode($address, $tld = 'com') {
   $key = gmap_get_key();
-  $data = drupal_http_request('http://maps.google.' . $tld . '/maps/geo?q=' . drupal_urlencode($address) . '&output=csv&key=' . $key);
+  $protocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
+  $data = drupal_http_request($protocol . '://maps.google.' . $tld . '/maps/geo?q=' . drupal_urlencode($address) . '&output=csv&key=' . $key);
   if ($data->code == 200) {
     $r = explode(',', $data->data);
     return array(
