b04a39a028980ea32b2ac62950bdff0a67de16d0 galt Wed Jul 18 14:48:19 2018 -0700 Add missing CSP header to pages not handled automatically by library functions. refs #21729. diff --git src/hg/phyloPng/phyloPng.c src/hg/phyloPng/phyloPng.c index 2eb5aa0..ee9dc37 100644 --- src/hg/phyloPng/phyloPng.c +++ src/hg/phyloPng/phyloPng.c @@ -539,31 +539,31 @@ "6. Wrap-in-html is useful when the browser automatically shrinks a large image.\n" "This option keeps the image view full in the browser automatically.\n" "<br>" ); cartWebEnd(); return 0; } else usage("-phyloPng_tree is a required 'option' or cgi variable."); } if (htmlPageWrapper) { printf("Content-type: text/html\r\n"); printf("\r\n"); - puts("<html><head><title>Phylogenetic Tree</title></head><body>"); + printf("<html><head>\n%s<title>Phylogenetic Tree</title></head><body>",getCspMetaHeader()); printf("<IMAGE SRC=\"http://%s%s" "?phyloPng_width=%d" "&phyloPng_height=%d" "&phyloPng_tree=%s" ,getenv("SERVER_NAME"),getenv("SCRIPT_NAME"),width,height,phyloData); if (branchLengths) printf("&phyloPng_branchLengths=1"); if (lengthLegend) printf("&phyloPng_lengthLegend=1"); if (branchLabels) printf("&phyloPng_branchLabels=1"); printf("&phyloPng_branchDecimals=%d",branchDecimals); printf("&phyloPng_branchMultipliers=%d",branchMultiplier); if (stripUnderscoreSuff) printf("&phyloPng_underscores=1"); @@ -618,31 +618,31 @@ { phyloTree = phyloParseString(phyloData); } errCatchEnd(errCatch); if (errCatch->gotError) { errMsg = cloneString(errCatch->message->string); } errCatchFree(&errCatch); if (errMsg) { if (onWeb) { printf("Content-type: text/html\r\n"); printf("\r\n"); - puts("<html><head><title>PhyloTree parse error</title></head><body><pre>"); + printf("<html><head>\n%s<title>PhyloTree parse error</title></head><body><pre>",getCspMetaHeader()); /* we dont think the specific error message coming back are correct or useful * so supply a generic err msg */ htmlPrintf("Original input tree:\n[%s]\n\n",cgiString("phyloPng_tree")); htmlPrintf("Input tree as passed to parser:\n[%s]\n\n",phyloData); printf("Parser syntax error:\n%s",errMsg); puts("</pre></body></html>"); } else { warn("%s", errMsg); } freez(&errMsg); freez(&phyloData); return 0; } @@ -665,31 +665,31 @@ lengthLegend = lengthLegend && branchLengths; /* moot without lengths */ if (lengthLegend) { int fHeight = mgFontPixelHeight(font); height -= (MARGIN+2*fHeight); } phyloTreeLayoutBL(phyloTree, &maxDepth, &numLeafs, 0, font, &maxLabelWidth, width, &minMaxFactor, 0.0); if (layoutErrMsg[0] != 0) { if (onWeb) { printf("Content-type: text/html\r\n"); printf("\r\n"); - puts("<html><head><title>PhyloTree error</title></head><body><pre>"); + printf("<html><head>\n%s<title>PhyloTree error</title></head><body><pre>",getCspMetaHeader()); printf("input tree: [%s]\n\n%s",cgiString("phyloPng_tree"),layoutErrMsg); puts("</pre></body></html>"); } else { warn("%s", layoutErrMsg); } freez(&phyloData); mgFree(&mg); return 0; } if (branchLengths) phyloTreePngBL(phyloTree, maxDepth, numLeafs, maxLabelWidth, width, height, mg, font, minMaxFactor, FALSE);