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/lib/web.c src/hg/lib/web.c
index 5631958..f56a53f 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -227,44 +227,32 @@
     puts(menuStr);
     }
 
 if (endsWith(scriptName, "hgGateway") && geoMirrorEnabled())
     {
     // Show an opt-out alert if user is on a host to which user has been automatically redirected (just once, right after they have been redirected)
     char *source = cgiOptionalString("source");
     char *redirect = cgiOptionalString("redirect");
     if (source != NULL && redirect != NULL && sameString(redirect, "auto"))
 	{
 	char *domain = cgiServerName();
 	char *port = cgiServerPort();
         // We don't bother maintaining stuff in request URI, because it may contain items like hgsid and other host specific values
         int newUriSize = 2048;
 	char *newUri = needMem(newUriSize);
-	// TODO what about https?
-	safef(newUri, newUriSize, "http://%s:%s/cgi-bin/hgGateway?redirect=manual&source=%s", source, port, domain);
-
-	//empty TD disappears
-	/*
-	printf("<TR><TD COLSPAN=3 id='redirectTd' onclick=\"javascript:document.getElementById('redirectTd').innerHTML='';\">"
-	    "<center>"
-	    "You've been redirected to your nearest mirror - %s<br>"
-	    "<a href=\"%s\">Take me back to %s</a>"
-	    "</center>"
-	    "</TD></TR>\n"
-	    , domain, newUri, source );
-	    "<h3 style=\"background-color: #2636d1; text-align: center; color:#E0F0F0; margin-top:0px;\">"
-	*/
+	safef(newUri, newUriSize, "http%s://%s:%s/cgi-bin/hgGateway?redirect=manual&source=%s", 
+	    cgiServerHttpsIsOn() ? "s" : "", source, port, domain);
 
 	printf("<TR><TD COLSPAN=3 id='redirectTd' onclick=\"javascript:document.getElementById('redirectTd').innerHTML='';\">"
 	    "<div style=\"margin: 10px 25%%; border-style:solid; border-width:thin; border-color:#97D897;\">"
 	    "<h3 style=\"background-color: #97D897; text-align: left; margin-top:0px; margin-bottom:0px;\">"
 	    "&nbsp;You've been redirected to your nearest mirror - %s"
 	    "<idiv style=\"float:right;\">[x]</idiv>"
 	    "</h3> "
 	    "<ul style=\"margin:5px;\">"
 	    "<li>Take me back to <a href=\"%s\">%s</a>"
 	    "<idiv style=\"float:right;\"><a href=\"../goldenPath/help/genomeEuro.html\">What is this?</a></idiv>"
 	    "</li>"
 	    "</ul>"
 	    "</div>"
 	    "</TD></TR>\n"
 	    , domain, newUri, source );