090d4afcaf0482dfa3f5eaec25d915f1d4a9fa9e max Thu Jun 15 13:34:32 2017 -0700 Cleanup of hgSession to make the distinction between the login server and local server clearer in the code. Renaming and moving two functions from wikiLink to hdb, as at least one is not necessarily wikiLink-related and it's good to keep them together. Also adding a warning to hgSession.c (probably useless). refs #19632 and also see related tickets there. diff --git src/hg/hgLogin/hgLogin.c src/hg/hgLogin/hgLogin.c index a0e52bd..63b30fd 100644 --- src/hg/hgLogin/hgLogin.c +++ src/hg/hgLogin/hgLogin.c @@ -287,44 +287,36 @@ struct dyString *getLoginCookieJS(char *userName, uint idx) /* returns javascript statements that set the cookies associated with * logging in as a particular user */ { struct dyString *result = dyStringNew(1024); struct slName *newCookies = loginLoginUser(userName, idx), *sl; for (sl = newCookies; sl != NULL; sl = sl->next) dyStringPrintf(result, " document.cookie = '%s';", sl->name); return result; } char *getReturnToURL() /* get URL from cart var returnto; if empty, make URL to hgSession on login host. */ { char *returnURL = cartUsualString(cart, "returnto", ""); -char *hgLoginHost = wikiLinkHost(); -char *cgiDir = cgiScriptDirUrl(); char returnTo[2048]; -boolean relativeLink = cfgOptionBooleanDefault(CFG_LOGIN_RELATIVE, FALSE); if (!returnURL || sameString(returnURL,"")) - // XX replace with call to new function hLoginHostUrl - if (relativeLink) - // reverse proxies and all-https sites have no need for absolute links - safef(returnTo, sizeof(returnTo), "%shgSession?hgS_doMainPage=1", cgiDir); - else safef(returnTo, sizeof(returnTo), - "http%s://%s%shgSession?hgS_doMainPage=1", - cgiAppendSForHttps(), hgLoginHost, cgiDir); + "%shgSession?hgS_doMainPage=1", + hLoginHostCgiBinUrl()); else safecpy(returnTo, sizeof(returnTo), returnURL); return cloneString(returnTo); } void returnToURL(int delay) /* delay for delay mill-seconds then return to the "returnto" URL */ { char *returnURL = getReturnToURL(); jsInlineF( "setTimeout(function(){location='%s';}, %d);\n" , returnURL, delay); } static void redirectToLoginPage(char *paramStr)