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/cart.c src/hg/lib/cart.c index 48e8cc5..d579145 100644 --- src/hg/lib/cart.c +++ src/hg/lib/cart.c @@ -1337,30 +1337,42 @@ /* Clear cart in database. */ { int hguid = getCookieId(cookieName); int hgsid = getSessionId(); struct sqlConnection *conn = cartDefaultConnector(); clearDbContents(conn, "userDb", hguid); clearDbContents(conn, "sessionDb", hgsid); cartDefaultDisconnector(&conn); } void cartWriteCookie(struct cart *cart, char *cookieName) /* Write out HTTP Set-Cookie statement for cart. */ { printf("Set-Cookie: %s=%u; path=/; domain=%s; expires=%s\r\n", cookieName, cart->userInfo->id, cfgVal("central.domain"), cookieDate()); +#ifdef SUPPORT_EURONODE +char *redirect = cgiOptionalString("redirect"); +char *source = cgiOptionalString("source"); +if (redirect && !source) + { + printf("Set-Cookie: redirect=mirror; path=/; domain=%s; expires=%s\r\n", cgiServerName(), cookieDate()); + // DEBUG REMOVE: + fprintf(stderr, "GALT Set-Cookie: redirect=mirror; path=/; domain=%s; expires=%s\r\n", + cfgVal("central.domain"), cookieDate()); + fflush(stderr); + } +#endif } struct cart *cartForSession(char *cookieName, char **exclude, struct hash *oldVars) /* This gets the cart without writing any HTTP lines at all to stdout. */ { int hguid = getCookieId(cookieName); int hgsid = getSessionId(); struct cart *cart = cartNew(hguid, hgsid, exclude, oldVars); cartExclude(cart, sessionVar); if (sameOk(cfgOption("signalsHandler"), "on")) /* most cgis call this routine */ initSigHandlers(hDumpStackEnabled()); char *httpProxy = cfgOption("httpProxy"); /* most cgis call this routine */ if (httpProxy) setenv("http_proxy", httpProxy, TRUE); /* net.c cannot see the cart, pass the value through env var */