407d5437ca4259b543fce0df3a4d9a61db556cbc braney Wed Feb 25 11:19:08 2015 -0800 only do cool UDC long directory hashing if USE_SSL=1 diff --git src/lib/udc.c src/lib/udc.c index 42962f0..499244b 100644 --- src/lib/udc.c +++ src/lib/udc.c @@ -779,41 +779,43 @@ *retColon = colon; } void udcParseUrl(char *url, char **retProtocol, char **retAfterProtocol, char **retColon) /* Parse the URL into components that udc treats separately. * *retAfterProtocol is Q-encoded to keep special chars out of filenames. * Free *retProtocol and *retAfterProtocol but not *retColon when done. */ { udcParseUrlFull(url, retProtocol, retAfterProtocol, retColon, NULL); } static void addElementToDy(struct dyString *dy, char *name) /* add one element of a path to a dyString, hashing it if it's longer * than MAXNAMLEN */ { +#ifdef USE_SSL if (strlen(name) > MAXNAMLEN) { unsigned char hash[SHA_DIGEST_LENGTH]; char newName[(SHA_DIGEST_LENGTH + 1) * 2]; SHA1((const unsigned char *)name, strlen(name), hash); hexBinaryString(hash, SHA_DIGEST_LENGTH, newName, (SHA_DIGEST_LENGTH + 1) * 2); dyStringAppend(dy, newName); } else +#endif dyStringAppend(dy, name); } static char *longDirHash(char *name) /* take a path and hash the elements that are longer than MAXNAMLEN */ { struct dyString *dy = newDyString(strlen(name)); char *ptr = strchr(name, '/'); while(ptr) { *ptr = 0; addElementToDy(dy, name); dyStringAppend(dy, "/");