76e6620f0bfc2240b45505446f5cba41b9b72817 max Thu Mar 6 03:39:36 2014 -0800 Allow special value HTTPHOST for central.domain and wiki.host, so aserver can be reached under multiple names. Might be a good default value for our example hg.conf? refs #11957 diff --git src/hg/lib/cart.c src/hg/lib/cart.c index 2fd1c6d..5d7fa4e 100644 --- src/hg/lib/cart.c +++ src/hg/lib/cart.c @@ -1351,32 +1351,43 @@ void cartResetInDb(char *cookieName) /* 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. */ { +char *domain = cfgVal("central.domain"); +if (sameWord("HTTPHOST", domain)) + { + // IE9 does not accept portnames in cookie domains + char *hostWithPort = hHttpHost(); + struct netParsedUrl *url; + AllocVar(url); + netParseUrl(hostWithPort, url); + domain = url->host; + } + printf("Set-Cookie: %s=%u; path=/; domain=%s; expires=%s\r\n", - cookieName, cart->userInfo->id, cfgVal("central.domain"), cookieDate()); + cookieName, cart->userInfo->id, domain, cookieDate()); if(geoMirrorEnabled()) { // This occurs after the user has manually choosen to go back to the original site; we store redirect value into a cookie so we // can use it in subsequent hgGateway requests before loading the user's cart char *redirect = cgiOptionalString("redirect"); if (redirect) { printf("Set-Cookie: redirect=%s; path=/; domain=%s; expires=%s\r\n", redirect, cgiServerName(), cookieDate()); } } } struct cart *cartForSession(char *cookieName, char **exclude, struct hash *oldVars) /* This gets the cart without writing any HTTP lines at all to stdout. */