2 * Sherlock Library -- URL Keys & URL Fingerprints
4 * (c) 2003 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
12 #include "lib/index.h"
17 static uns urlkey_www_hack;
19 static struct cfitem urlkey_config[] = {
20 { "URLKey", CT_SECTION, NULL },
21 { "WWWHack", CT_INT, &urlkey_www_hack },
22 { NULL, CT_STOP, NULL }
25 static void CONSTRUCTOR urlkey_conf_init(void)
27 cf_register(urlkey_config);
31 url_key(byte *url, byte *buf)
33 if (urlkey_www_hack && !strncmp(url, "http://www.", 11))
35 strcpy(buf, "http://");
36 strcpy(buf+7, url+11);
44 url_fingerprint(byte *url, struct fingerprint *fp)
46 byte buf[MAX_URL_SIZE];
47 return fingerprint(url_key(url, buf), fp);