d9719e1d52b657fec9bf6676c85a4d2458fd7e89 galt Thu Apr 27 15:54:31 2017 -0700 Remove optional compile switch USE_SSL so that openssl is now an official kent repo dependency. Also using openssl sha1 in hgTracks multiregion. refs #17358. diff --git src/lib/udc.c src/lib/udc.c index f2851fa..90f9c23 100644 --- src/lib/udc.c +++ src/lib/udc.c @@ -24,33 +24,31 @@ * for each block of the file that has been fetched. Currently the block size is 8K. */ #include #include "common.h" #include "hash.h" #include "obscure.h" #include "bits.h" #include "linefile.h" #include "portable.h" #include "sig.h" #include "net.h" #include "cheapcgi.h" #include "udc.h" #include "hex.h" #include -#ifdef USE_SSL #include -#endif /* The stdio stream we'll use to output statistics on file i/o. Off by default. */ FILE *udcLogStream = NULL; void udcSetLog(FILE *fp) /* Turn on logging of file i/o. * For each UDC file two lines are written. One line for the open, and one line for the close. * The Open line just has the URL being opened. * The Close line has the the URL plus a bunch of counts of the number of seeks, reads, and writes * for the following four files: the udc bitmap, the udc sparse data, the incoming calls * to the UDC layer, and the network connection to the (possibly) remote file. * There are two additional counts: the number of socket connects, and the * number of times a socket is reused instead of closed and reopened. */ { @@ -981,43 +979,41 @@ *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, "/");