c4e00067ef764ef4c49a49d3d7b78606cc786f04
galt
  Mon Jul 1 12:50:41 2013 -0700
fixes #11192 -- handling https in redirects between ucsc and other official mirror sites like genome-euro
diff --git src/hg/hgGateway/hgGateway.c src/hg/hgGateway/hgGateway.c
index 10c8c06..67df07b 100644
--- src/hg/hgGateway/hgGateway.c
+++ src/hg/hgGateway/hgGateway.c
@@ -303,32 +303,32 @@
 
         // get location of redirect node
         if (thisNode != node)
             {
 	    char *geoSuffix = cfgOptionDefault("browser.geoSuffix","");
             char query[1056];
             sqlSafef(query, sizeof query, "select domain from gbNode%s where node = %d", geoSuffix, node);
             char *newDomain = sqlQuickString(centralConn, query);
             //fprintf(stderr, "GALT newDomain=%s\n", newDomain); fflush(stderr); // DEBUG REMOVE
             char *oldDomain = cgiServerName();
             char *port = cgiServerPort();
             char *uri = cgiRequestUri();
             char *sep = strchr(uri, '?') ? "&" : "?";
             int newUriSize = strlen(uri) + 1024;
             char *newUri = needMem(newUriSize);
-            // TODO what about https?
-            safef(newUri, newUriSize, "http://%s:%s%s%sredirect=auto&source=%s", newDomain, port, uri, sep, oldDomain);
+            safef(newUri, newUriSize, "http%s://%s:%s%s%sredirect=auto&source=%s", 
+		cgiServerHttpsIsOn ? "s" : "", newDomain, port, uri, sep, oldDomain);
             struct dyString *dy = dyStringNew(256);
             dyStringPrintf(dy,
                            "HTTP/1.1 302 found: \n"
                            "Content-Type: text/html; charset=iso-8859-1\n"
                            "Connection: close\n"
                            "Location: %s\n"
                            "\n"
                            "<html><head><title>Redirecting to closer site</title></head>\n"
                            "<body><a href=\"%s\">%s</a></body>\n"
                            , newUri , newUri, newUri);
             //fprintf(stderr, "GALT redirect response:\n%s", dy->string); fflush(stderr); // DEBUG REMOVE
             puts(dyStringContents(dy));
             exit(0);
             }
         hDisconnectCentral(&centralConn);