1dfc28f6ac392a1cc937440390d9da53cd771125 max Mon Aug 10 13:36:16 2015 -0700 oops, forgot to strip off hgsid when sending current URL to external site diff --git src/hg/hgTracks/extTools.c src/hg/hgTracks/extTools.c index 946571b..50ec9cf 100644 --- src/hg/hgTracks/extTools.c +++ src/hg/hgTracks/extTools.c @@ -6,30 +6,31 @@ /* Copyright (C) 2014 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "common.h" #include "dystring.h" #include "hCommon.h" #include "htmshell.h" #include "hash.h" #include "web.h" #include "ra.h" #include "hgTracks.h" #include "extTools.h" #include "hgFind.h" #include "obscure.h" +#include "net.h" static char *getRequiredRaSetting(struct hash *hash, char *name, struct lineFile *lf) /* Grab a group setting out of the ra hash. errAbort if not found. */ { char *str; if ((str = hashFindVal(hash, name)) == NULL) errAbort("missing required setting '%s' on line %d in file %s\n", name, lf->lineIx, lf->fileName); return str; } struct extTool *readExtToolRa(char *raFileName) /* parse the extTools.ra file. Inspired by trackHub.c:readGroupRa() */ { struct lineFile *lf = udcWrapShortLineFile(raFileName, NULL, 1*1024*1024); @@ -133,32 +134,40 @@ "Try to zoom in some more.
\n", et->maxSize); return; } boolean submitDone = FALSE; for (slp=et->params; slp!=NULL; slp=slp->next) { char* val = slp->val; if (sameWord(val, "$db")) val = db; if (sameWord(val, "$position")) val = pos; if (sameWord(val, "$returnUrl")) { char* host = getenv("HTTP_HOST"); - char* uri = getenv("REQUEST_URI"); - val = catTwoStrings(host, uri); + char* reqUrl = getenv("REQUEST_URI"); + + struct netParsedUrl npu; + netParseUrl(reqUrl, &npu); + safecpy(npu.protocol, sizeof(npu.protocol), "http"); + safecpy(npu.host, sizeof(npu.host), host); + // remove everything after ? in URL + char *e = strchr(npu.file, '?'); + if (e) *e = 0; + val = urlFromNetParsedUrl(&npu); } // half the current window size if (stringIn("$halfLen", val)) { char buf[64]; safef(buf, sizeof(buf), "%d", len/2); val = replaceChars(val, "$halfLen", buf); } if (sameWord(val, "$seq")) { static struct dnaSeq *seq = NULL; seq = hDnaFromSeq(db, chromName, winStart, winEnd, dnaLower); val = seq->dna; } // any remaining $-expression might be one of the general ones