f64df8332a2328c2fe6325dcd1cb0b9281586957 galt Thu Feb 10 01:55:48 2011 -0800 added alternate method for finding filesize via byterange, useful workaround for udc used against poorly configured remote apache servers diff --git src/inc/net.h src/inc/net.h index 76e47e7..1e92363 100644 --- src/inc/net.h +++ src/inc/net.h @@ -120,36 +120,46 @@ */ int netUrlOpen(char *url); /* Return socket descriptor (low-level file handle) for read()ing url data, * or -1 if error. Just close(result) when done. */ int netUrlOpenSockets(char *url, int *retCtrlSocket); /* Return socket descriptor (low-level file handle) for read()ing url data, * or -1 if error. * If retCtrlSocket is non-NULL and url is FTP, set *retCtrlSocket * to the FTP control socket which is left open for a persistent connection. * close(result) (and close(*retCtrlSocket) if applicable) when done. */ struct hash; +int netUrlHeadExt(char *url, char *method, 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: . */ + 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: . */ +long long netUrlSizeByRangeResponse(char *url); +/* Use byteRange as a work-around alternate method to get file size (content-length). + * Return negative number if can't get. */ + 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. Result will include http headers and