1f1ad77303a89026caa686b37d4199a62c94bf43 kent Tue Feb 1 12:38:07 2011 -0800 Making it so that track html description is fetched for hgc and hgTrackUi. To do this had to get a way to fetch a text file from a URL without putting up any warning messages if it was not there, which ended up requiring a new warning handler. diff --git src/lib/linefile.c src/lib/linefile.c index 90839bc..b2d9a11 100644 --- src/lib/linefile.c +++ src/lib/linefile.c @@ -726,30 +726,42 @@ } char *lineFileSkipToLineStartingWith(struct lineFile *lf, char *start, int maxCount) /* Skip to next line that starts with given string. Return NULL * if no such line found, otherwise return the line. */ { char *line; while (lineFileNext(lf, &line, NULL) && --maxCount >= 0) { if (startsWith(start, line)) return line; } return NULL; } +char *lineFileReadAll(struct lineFile *lf) +/* Read remainder of lineFile and return it as a string. */ +{ +struct dyString *dy = dyStringNew(1024*4); +lf->zTerm = 0; +int size; +char *line; +while (lineFileNext(lf, &line, &size)) + dyStringAppendN(dy, line, size); +return dyStringCannibalize(&dy); +} + boolean lineFileParseHttpHeader(struct lineFile *lf, char **hdr, boolean *chunked, int *contentLength) /* Extract HTTP response header from lf into hdr, tell if it's * "Transfer-Encoding: chunked" or if it has a contentLength. */ { struct dyString *header = newDyString(1024); char *line; int lineSize; if (chunked != NULL) *chunked = FALSE; if (contentLength != NULL) *contentLength = -1; dyStringClear(header); if (lineFileNext(lf, &line, &lineSize))