/*
- * $Id: htcp.cc,v 1.22 1998/09/04 23:04:48 wessels Exp $
+ * $Id: htcp.cc,v 1.23 1998/09/21 06:52:13 wessels Exp $
*
* DEBUG: section 31 Hypertext Caching Protocol
* AUTHOR: Duane Wesssels
s->version);
m = urlParseMethod(s->method);
debug(31, 1) ("htcpHandleTstRequest: %s\n", s->req_hdrs);
- key = storeKeyPublic(s->uri, m);
- e = storeGet(key);
+ e = storeGetPublic(s->uri, m);
if (NULL == e) {
/* cache miss */
htcpTstReply(dhdr, NULL, NULL, from);
/*
- * $Id: http.cc,v 1.322 1998/09/19 17:06:05 wessels Exp $
+ * $Id: http.cc,v 1.323 1998/09/21 06:52:14 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
httpMaybeRemovePublic(StoreEntry * e, http_status status)
{
int remove = 0;
- const cache_key *key;
StoreEntry *pe;
if (!EBIT_TEST(e->flags, KEY_PRIVATE))
return;
if (!remove)
return;
assert(e->mem_obj);
- key = storeKeyPublic(e->mem_obj->url, e->mem_obj->method);
- if ((pe = storeGet(key)) != NULL) {
+ if ((pe = storeGetPublic(e->mem_obj->url, e->mem_obj->method)) != NULL) {
assert(e != pe);
storeRelease(pe);
}
if (e->mem_obj->method == METHOD_GET) {
/* A fresh GET should eject old HEAD objects */
- key = storeKeyPublic(e->mem_obj->url, METHOD_HEAD);
- if ((pe = storeGet(key)) != NULL) {
+ if ((pe = storeGetPublic(e->mem_obj->url, METHOD_HEAD)) != NULL) {
assert(e != pe);
storeRelease(pe);
}
/*
- * $Id: icp_v2.cc,v 1.52 1998/09/15 19:37:49 wessels Exp $
+ * $Id: icp_v2.cc,v 1.53 1998/09/21 06:52:15 wessels Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
flags |= ICP_FLAG_SRC_RTT;
}
/* The peer is allowed to use this cache */
- key = storeKeyPublic(url, METHOD_GET);
- entry = storeGet(key);
+ entry = storeGetPublic(url, METHOD_GET);
debug(12, 5) ("icpHandleIcpV2: OPCODE %s\n", icp_opcode_str[header.opcode]);
if (icpCheckUdpHit(entry, icp_request)) {
reply = icpCreateMessage(ICP_HIT, flags, url, header.reqnum, src_rtt);
/*
- * $Id: icp_v3.cc,v 1.25 1998/09/11 17:07:44 wessels Exp $
+ * $Id: icp_v3.cc,v 1.26 1998/09/21 06:52:16 wessels Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
break;
}
/* The peer is allowed to use this cache */
- key = storeKeyPublic(url, METHOD_GET);
- entry = storeGet(key);
+ entry = storeGetPublic(url, METHOD_GET);
debug(12, 5) ("icpHandleIcpV3: OPCODE %s\n",
icp_opcode_str[header.opcode]);
if (icpCheckUdpHit(entry, icp_request)) {
/*
- * $Id: mime.cc,v 1.80 1998/09/19 17:06:06 wessels Exp $
+ * $Id: mime.cc,v 1.81 1998/09/21 06:52:17 wessels Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
LOCAL_ARRAY(char, path, MAXPATHLEN);
LOCAL_ARRAY(char, url, MAX_URL);
char *buf;
- const cache_key *key;
const char *type = mimeGetContentType(icon);
if (type == NULL)
fatal("Unknown icon format while reading mime.conf\n");
buf = internalLocalUri("/squid-internal-static/icons/", icon);
xstrncpy(url, buf, MAX_URL);
- key = storeKeyPublic(url, METHOD_GET);
- if (storeGet(key))
+ if (storeGetPublic(url, METHOD_GET))
return;
snprintf(path, MAXPATHLEN, "%s/%s", Config.icons.directory, icon);
fd = file_open(path, O_RDONLY, NULL, NULL, NULL);
/*
- * $Id: protos.h,v 1.269 1998/09/21 06:42:57 wessels Exp $
+ * $Id: protos.h,v 1.270 1998/09/21 06:52:19 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
*/
extern StoreEntry *new_StoreEntry(int, const char *, const char *);
extern StoreEntry *storeGet(const cache_key *);
+extern StoreEntry *storeGetPublic(const char *uri, const method_t method);
extern StoreEntry *storeCreateEntry(const char *, const char *, request_flags, method_t);
extern void storeSetPublicKey(StoreEntry *);
extern void storeComplete(StoreEntry *);
extern void storeKeyFree(const cache_key *);
extern const cache_key *storeKeyScan(const char *);
extern const char *storeKeyText(const cache_key *);
-extern const cache_key *storeKeyPublic(const char *, method_t);
+extern const cache_key *storeKeyPublic(const char *, const method_t);
+extern const cache_key *storeKeyPublicOld(const char *, method_t);
extern const cache_key *storeKeyPrivate(const char *, method_t, int);
extern int storeKeyHashBuckets(int);
extern int storeKeyNull(const cache_key *);
/*
- * $Id: store.cc,v 1.462 1998/09/19 17:06:12 wessels Exp $
+ * $Id: store.cc,v 1.463 1998/09/21 06:52:22 wessels Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
return (StoreEntry *) hash_lookup(store_table, key);
}
+StoreEntry *
+storeGetPublic(const char *uri, const method_t method)
+{
+ cache_key *key;
+ StoreEntry *e;
+ key = storeKeyPublic(uri, method);
+ e = storeGet(key);
+ if (e == NULL && squid_curtime < 909000000) {
+ key = storeKeyPublicOld(uri, method);
+ e = storeGet(key);
+ }
+ return storeGet(key);
+}
+
static int
getKeyCounter(void)
{
/*
- * $Id: store_key_md5.cc,v 1.16 1998/09/15 19:38:02 wessels Exp $
+ * $Id: store_key_md5.cc,v 1.17 1998/09/21 06:52:23 wessels Exp $
*
* DEBUG: section 20 Storage Manager MD5 Cache Keys
* AUTHOR: Duane Wessels
}
const cache_key *
-storeKeyPublic(const char *url, method_t method)
+storeKeyPublic(const char *url, const method_t method)
{
static cache_key digest[MD5_DIGEST_CHARS];
MD5_CTX M;
return digest;
}
+/*
+ * Compatibility transition period. Remove this after Oct 21, 1998
+ */
+const cache_key *
+storeKeyPublicOld(const char *url, method_t method)
+{
+ static cache_key digest[MD5_DIGEST_CHARS];
+ MD5_CTX M;
+ int n;
+ char key_buf[MAX_URL + 100];
+ n = snprintf(key_buf, sizeof(key_buf), "%s %s",
+ RequestMethodStr[method],
+ url);
+ MD5Init(&M);
+ MD5Update(&M, (unsigned char *) key_buf, n);
+ MD5Final(digest, &M);
+ return digest;
+}
+
const cache_key *
storeKeyDup(const cache_key * key)
{
/*
*
- * $Id: urn.cc,v 1.45 1998/09/14 22:18:04 wessels Exp $
+ * $Id: urn.cc,v 1.47 1998/09/21 06:52:23 wessels Exp $
*
* DEBUG: section 52 URN Parsing
* AUTHOR: Kostas Anagnostakis
#include "squid.h"
-enum {
- URN_FORCE_MENU
-};
-
typedef struct {
StoreEntry *entry;
StoreEntry *urlres_e;
{
LOCAL_ARRAY(char, urlres, 4096);
request_t *urlres_r = NULL;
- const cache_key *k;
const char *t;
char *host;
UrnState *urnState;
}
snprintf(urlres, 4096, "http://%s/uri-res/N2L?urn:%s", host, strBuf(r->urlpath));
safe_free(host);
- k = storeKeyPublic(urlres, METHOD_GET);
urlres_r = urlParse(METHOD_GET, urlres);
if (urlres_r == NULL) {
debug(52, 3) ("urnStart: Bad uri-res URL %s\n", urlres);
return;
}
httpHeaderPutStr(&urlres_r->header, HDR_ACCEPT, "text/plain");
- if ((urlres_e = storeGet(k)) == NULL) {
+ if ((urlres_e = storeGetPublic(urlres, METHOD_GET)) == NULL) {
urlres_e = storeCreateEntry(urlres, urlres, null_request_flags, METHOD_GET);
storeClientListAdd(urlres_e, urnState);
fwdStart(-1, urlres_e, urlres_r, no_addr);
char *token;
char *url;
char *host;
- const cache_key *key;
int rtt;
url_entry *list;
url_entry *old;
debug(52, 3) ("urnParseReply: Pinging %s\n", host);
netdbPingSite(host);
}
- key = storeKeyPublic(url, m);
list[i].url = url;
list[i].host = xstrdup(host);
list[i].rtt = rtt;
- list[i].flags.cached = storeGet(key) ? 1 : 0;
+ list[i].flags.cached = storeGetPublic(url, m) ? 1 : 0;
i++;
}
debug(0, 0) ("urnParseReply: Found %d URLs\n", i);