90d648fa2085f370a74fcf648fc7060efde39640 kent Sun Mar 31 15:57:03 2013 -0700 Added netUrlMustOpenPastHeader diff --git src/inc/net.h src/inc/net.h index fb68576..1551782 100644 --- src/inc/net.h +++ src/inc/net.h @@ -116,31 +116,39 @@ ssize_t byteRangeEnd; /* End of byte range use -1 for none */ }; void netParseUrl(char *url, struct netParsedUrl *parsed); /* Parse a URL into components. A full URL is made up as so: * http://user:password@hostName:port/file;byterange=0-499 * User and password may be cgi-encoded. * This is set up so that the http:// and the port are optional. */ char *urlFromNetParsedUrl(struct netParsedUrl *npu); /* Build URL from netParsedUrl structure */ 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. */ + * or -1 if error. Just close(result) when done. Errors from this routine + * from web urls are rare, because this just opens up enough to read header, + * which may just say "file not found." Consider using netUrlMustOpenPastHeader + * instead .*/ + +int netUrlMustOpenPastHeader(char *url); +/* Get socket descriptor for URL. Process header, handling any forwarding and + * the like. Do errAbort if there's a problem, which includes anything but a 200 + * return from http after forwarding. */ 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: . */