8bb6e8cc14b264b4a32b855045151e98638267c3 galt Tue Mar 28 23:12:00 2017 -0700 Step1 Seven Bridges HIPAA-compliant Amazon Storage securely signed URLs meant for GET do not allow them to be used with another method such as HEAD. Therefore we use a GET with byterange=0-0 so that it will still work with Amazon and still return correct info about size and last-modified date of the bigDataUrl file. refs #19158 diff --git src/lib/net.c src/lib/net.c index 5f604f5..25eecf2 100644 --- src/lib/net.c +++ src/lib/net.c @@ -1282,54 +1282,38 @@ status = errno; return status; } 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: . */ { return netUrlHeadExt(url, "HEAD", hash); } -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. */ +int netUrlFakeHeadByGet(char *url, struct hash *hash) +/* Use GET with byteRange as an alternate method to HEAD. + * Return status. */ { -long long retVal = -1; char rangeUrl[MAXURLSIZE]; safef(rangeUrl, sizeof(rangeUrl), "%s;byterange=0-0", url); -struct hash *hash = newHash(0); int status = netUrlHeadExt(rangeUrl, "GET", hash); -if (status == 206) - { - char *rangeString = hashFindValUpperCase(hash, "Content-Range:"); - if (rangeString) - { - /* input pattern: Content-Range: bytes 0-99/2738262 */ - char *slash = strchr(rangeString,'/'); - if (slash) - { - retVal = atoll(slash+1); - } - } - } -hashFree(&hash); -return retVal; +return status; } 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. * If url is missing :// then it's just treated as a file. */ { if (stringIn("://", url) == NULL) return open(url, O_RDONLY); else {