7181c0af889a0eee451b91ff0b23d67f35e0e772 braney Tue Aug 18 08:39:08 2026 -0700 cheapcgi, customTrack, hgSession, hgPhyloPlace: track in-memory uploads in a registry Uploaded file contents are handed to the reading code as a text address and size. Collect that bookkeeping in cheapcgi, which now records each block it makes and hands back a name for it, and have the custom track, session and phyloPlace upload paths look the block up by that name. Also removes the duplicated address/size parsing those callers each had, and makes lineFileDecompressMem ignore a too-small buffer. refs #38108 diff --git src/hg/hgPhyloPlace/hgPhyloPlace.c src/hg/hgPhyloPlace/hgPhyloPlace.c index d11553d2ce9..a124267970b 100644 --- src/hg/hgPhyloPlace/hgPhyloPlace.c +++ src/hg/hgPhyloPlace/hgPhyloPlace.c @@ -55,37 +55,35 @@ char cartVar[2048]; safef(cartVar, sizeof cartVar, "%s__binary", fileVar); char *fileBinaryCoords = cartOptionalString(cart, cartVar); // Also get the file name for error reporting. safef(cartVar, sizeof cartVar, "%s__filename", fileVar); char *fileName = cartOptionalString(cart, cartVar); if (fileName == NULL) fileName = "<uploaded data>"; if (isNotEmpty(filePlainContents)) { lf = lineFileOnString(fileName, TRUE, cloneString(trimSpaces(filePlainContents))); } else if (isNotEmpty(fileBinaryCoords)) { fprintf(stderr, "%s=%s fileBinaryCoords=%s\n", cartVar, fileName, fileBinaryCoords); - char *binInfo = cloneString(fileBinaryCoords); - char *words[2]; - char *mem; + /* The cart holds the address and size of the uploaded bytes, but any + * request can set that variable, so only use a block cheapcgi handed out. */ unsigned long size; - chopByWhite(binInfo, words, ArraySize(words)); - mem = (char *)sqlUnsignedLong(words[0]); - size = sqlUnsignedLong(words[1]); + char *mem = cgiMemBlobFind(fileBinaryCoords, &size); + if (mem != NULL) lf = lineFileDecompressMem(TRUE, mem, size); } return lf; } static void selectOrg(char **pOrg, char **pLabel) /* Search for config files in hgPhyloPlaceData. If there is more than one * supported organism, then make a menu / select input for supported organisms; * reload the page on change. */ { struct slPair *orgLabelList = phyloPlaceOrgList(cart); if (orgLabelList == NULL) errAbort("Sorry, this server is not configured to perform phylogenetic placement."); if (!slPairFind(orgLabelList, *pOrg)) {