58017171c4c59e5bfb783aebafeb7ec41bd3bae8
larrym
Thu Dec 22 13:50:47 2011 -0800
add euronode redirect code (#3104); mostly written by galt with some minor changes by me. Has some debug stuff which will be taken out as I work on this. Currently only on in larrym's tree and on euronode machine
diff --git src/hg/lib/web.c src/hg/lib/web.c
index eff04c6..fd3cbb1 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -374,30 +374,80 @@
printf("
Help | \n");
}
}
printf(" | \n"); // last column squeezes other columns left
puts("\n");
#endif
+#ifdef SUPPORT_EURONODE
+
+if (endsWith(scriptName, "hgGateway")) // DEBUG
+ {
+ char *source = cgiOptionalString("source");
+ if (source)
+ {
+ 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);
+ // TODO what about https?
+ safef(newUri, newUriSize, "http://%s:%s%s", source, port, uri);
+ char *zTerm = rStringIn("&source=", newUri);
+ if (zTerm)
+ *zTerm = 0;
+
+ //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"
+ " "
+ " "
+ " "
+ "- 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"
|
|
|