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/inc/net.h src/inc/net.h index 6fb0cc8..76e47e7 100644 --- src/inc/net.h +++ src/inc/net.h @@ -135,35 +135,46 @@ int netUrlHead(char *url, struct hash *hash); /* Go get head and return status. Return negative number if * can't get head. If hash is non-null, fill it with header * lines with upper cased keywords for case-insensitive lookup, * including hopefully CONTENT-TYPE: . */ struct lineFile *netLineFileOpen(char *url); /* Return a lineFile attached to url. This one * will skip any headers. Free this with * lineFileClose(). */ struct lineFile *netLineFileMayOpen(char *url); /* Same as netLineFileOpen, but warns and returns * null rather than aborting on problems. */ +struct lineFile *netLineFileSilentOpen(char *url); +/* Open a lineFile on a URL. Just return NULL without any user + * visible warning message if there's a problem. */ + struct dyString *netSlurpFile(int sd); -/* Slurp file into dynamic string and return. */ +/* Slurp file into dynamic string and return. Result will include http headers and + * the like. */ struct dyString *netSlurpUrl(char *url); -/* Go grab all of URL and return it as dynamic string. */ +/* Go grab all of URL and return it as dynamic string. Result will include http headers + * and the like. This will errAbort if there's a problem. */ + +char *netReadTextFileIfExists(char *url); +/* Read entire URL and return it as a string. URL should be text (embedded zeros will be + * interpreted as end of string). If the url doesn't exist or has other problems, + * returns NULL. Does *not* include http headers. */ struct lineFile *netHttpLineFileMayOpen(char *url, struct netParsedUrl **npu); /* Parse URL and open an HTTP socket for it but don't send a request yet. */ void netHttpGet(struct lineFile *lf, struct netParsedUrl *npu, boolean keepAlive); /* Send a GET request, possibly with Keep-Alive. */ int netOpenHttpExt(char *url, char *method, char *optionalHeader); /* Return a file handle that will read the url. optionalHeader * may by NULL or may contain cookies and other info. */ int netHttpConnect(char *url, char *method, char *protocol, char *agent, char *optionalHeader); /* Parse URL, connect to associated server on port, and send most of * the request to the server. If specified in the url send user name