162403f0a5c9883baf6aca529af7570383114b8b larrym Tue Apr 3 16:13:55 2012 -0700 redirect code has gotten pretty long, so I moved it out of main diff --git src/hg/hgGateway/hgGateway.c src/hg/hgGateway/hgGateway.c index 9bb7031..18acf5b 100644 --- src/hg/hgGateway/hgGateway.c +++ src/hg/hgGateway/hgGateway.c @@ -285,43 +285,36 @@ buffer[0] = 0; if (*scientificName != 0) { if (sameString(clade,"ancestor")) safef(buffer, sizeof(buffer), "(%s Ancestor) ", scientificName); else safef(buffer, sizeof(buffer), "(%s) ", scientificName); } cartWebStart(theCart, db, "%s %s%s Gateway\n", organism, buffer, hBrowserName()); htmlDoEscape(); } hgGateway(); cartWebEnd(); } -char *excludeVars[] = {NULL}; - -int main(int argc, char *argv[]) -/* Process command line. */ -{ -oldVars = hashNew(10); -cgiSpoof(&argc, argv); - -if(cgiIsOnWeb()) +static void checkForGeoMirrorRedirect() { - // check IP for redirection +// Implement Geo/IP based redirection +// // NOTE that we want to redirect people as quickly as possible, so for efficiency purposes, this code is designed to be - // called BEFORE the cart is loaded (so we only use CGI parameters and/or cookies). +// called from main BEFORE the cart is loaded (so we only use CGI parameters and/or cookies). char *thisNodeStr = geoMirrorNode(); if (thisNodeStr) { char *redirectCookie = findCookieData("redirect"); char *redirect = cgiOptionalString("redirect"); fprintf(stderr, "GALT redirectCookie=%s redirect=%s\n", redirectCookie, redirect); fflush(stderr); // DEBUG REMOVE if (redirect == NULL && redirectCookie == NULL) { int thisNode = sqlUnsigned(thisNodeStr); struct sqlConnection *centralConn = hConnectCentral(); char query[1024]; @@ -370,18 +363,29 @@ "Connection: close\n" "Location: %s\n" "\n" "