13f391382e54e6589f383d87069040926c910196 max Fri Jun 6 05:57:51 2025 -0700 fixing web.c to output cookie so hgGateway uses cookies, refs #35824 diff --git src/hg/lib/web.c src/hg/lib/web.c index 4d0835b555d..a8afdf8d9f5 100644 --- src/hg/lib/web.c +++ src/hg/lib/web.c @@ -107,32 +107,30 @@ } void webCirmPragmasEtc() /* Print out stuff similar to webPragmasEtc (don't cache us, character set, etc.), but * use values appropriate for a more modern website (like CIRM). */ { printf("\t\t<meta charset=\"windows-1252\">\n" // Be nice to be utf-8, but that's a bigger issue to tackle "\t\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n" "\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n" "\t\t<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->\n"); } void webStartText() /* output the head for a text page */ { -/*printf("Content-Type: text/plain\n\n");*/ - webHeadAlreadyOutputed = TRUE; webInTextMode = TRUE; webPushErrHandlers(); } static void webStartWrapperDetailedInternal(struct cart *theCart, char *db, char *headerText, char *textOutBuf, boolean withHttpHeader, boolean withLogo, boolean skipSectionHeader, boolean withHtmlHeader) /* output a CGI and HTML header with the given title in printf format */ { char uiState[256]; char *scriptName = cgiScriptName(); char *textOutBufDb = cloneString(textOutBuf); boolean isEncode = FALSE; @@ -164,31 +162,34 @@ if (scriptName == NULL) scriptName = cloneString(""); /* don't output two headers */ if(webHeadAlreadyOutputed) return; if (sameString(cgiUsualString("action",""),"encodeReleaseLog") || rStringIn("EncodeDataVersions", scriptName)) isEncode = TRUE; /* Preamble. */ dnaUtilOpen(); if (withHttpHeader) - puts("Content-type:text/html\n"); + { + char *cookieName = hUserCookie(); + cartWriteHeaderAndCont(theCart, cookieName); + } // If the database name is not already in the title string, add it now if (endsWith(scriptName, "hgc") && db != NULL && !stringIn(db, textOutBufDb)) { struct dyString *newTitle = dyStringNew(0); dyStringPrintf(newTitle, "%s %s", trackHubSkipHubName(db), textOutBufDb); textOutBufDb = dyStringCannibalize(&newTitle); } if (withHtmlHeader) { char *newString, *ptr1, *ptr2; char *browserVersion; if (btIE == cgiClientBrowser(&browserVersion, NULL, NULL) && *browserVersion < '8') puts("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">"); @@ -479,31 +480,32 @@ #endif /* GBROWSE */ jsInlineFinish(); if (footer) puts(footer); puts( "</BODY></HTML>"); webPopErrHandlers(); } } static void webStartGbOptionalBanner(struct cart *cart, char *db, char *title, boolean doBanner, boolean hgGateway) /* Start HTML with new header and footer design by JWest. Optionally display banner above menubar. Use flag with hgGateway, till that is migrated. */ { -puts("Content-type:text/html\n"); +char *cookieName = hUserCookie(); +cartWriteHeaderAndCont(cart, cookieName); char *csp = getCspMetaHeader(); if (hgGateway) { printf( #include "jWestHeader.h" , csp, title , webTimeStampedLinkToResource("HGStyle.css", TRUE) , webTimeStampedLinkToResource("jWest.css", TRUE)); } else { printf( #include "gbHeader.h" , csp, title);