24295958e3a35c027cf4727e43823283d80ae697 larrym Tue Apr 3 12:48:49 2012 -0700 replace use of SUPPORT_EURONODE with geoMirrorEnabled() diff --git src/hg/lib/web.c src/hg/lib/web.c index fd3cbb1..6b4c66d 100644 --- src/hg/lib/web.c +++ src/hg/lib/web.c @@ -14,30 +14,31 @@ #include "dbDb.h" #include "hgColors.h" #include "hubConnect.h" #include "search.h" #ifndef GBROWSE #include "axtInfo.h" #include "wikiLink.h" #include "googleAnalytics.h" #include "jsHelper.h" #endif /* GBROWSE */ #include "errabort.h" // FIXME tmp hack to try to find source of popWarnHandler underflows in browse /* phoneHome business */ #include #include #include +#include "geoMirror.h" /* phoneHome business */ /* flag that tell if the CGI header has already been outputed */ boolean webHeadAlreadyOutputed = FALSE; /* flag that tell if text CGI header hsa been outputed */ boolean webInTextMode = FALSE; static char *dbCgiName = "db"; static char *orgCgiName = "org"; static char *cladeCgiName = "clade"; static char *extraStyle = NULL; /* global: a cart for use in error handlers. */ static struct cart *errCart = NULL; @@ -374,80 +375,74 @@ printf("Help\n"); } } printf(" \n"); // last column squeezes other columns left puts("\n"); #endif -#ifdef SUPPORT_EURONODE - -if (endsWith(scriptName, "hgGateway")) // DEBUG +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"); - if (source) + char *redirect = cgiOptionalString("redirect"); + if (source != NULL && redirect != NULL && sameString(redirect, "auto")) { char *domain = cgiServerName(); char *port = cgiServerPort(); - char *uri = cgiRequestUri(); - // /cgi-bin/test.cgi?x=15&y=youdog - int newUriSize = strlen(uri)+1024; - char *newUri = needMem(newUriSize); + // 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(2048); // TODO what about https? - safef(newUri, newUriSize, "http://%s:%s%s", source, port, uri); - char *zTerm = rStringIn("&source=", newUri); - if (zTerm) - *zTerm = 0; + safef(newUri, newUriSize, "http://%s:%s/cgi-bin/hgGateway?redirect=manual&source=%s", source, port, domain); //empty TD disappears /* printf("" "
" "You've been redirected to your nearest mirror - %s
" "Take me back to %s" "
" "\n" , domain, newUri, source ); "

" */ printf("" "
" "

" "" "You've been redirected to your nearest mirror - %s" "\"Hide" "

" "
    " "
  • Take me back to %s" "
  • " "
" "
" "\n" , domain, newUri, source ); } } -#endif - if(!skipSectionHeader) /* this HTML must be in calling code if skipSectionHeader is TRUE */ { puts( // TODO: Replace nested tables with CSS (difficulty is that tables are closed elsewhere) "" "\n" "\n" " \n" "
\n" "
\n" "
" ); htmlTextOut(textOutBuf); puts( "
\n"