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" "