/*
- * $Id: http.cc,v 1.142 1996/12/19 00:51:49 wessels Exp $
+ * $Id: http.cc,v 1.143 1996/12/19 21:24:13 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
request_t *request = NULL;
debug(11, 3, "proxyhttpStart: \"%s %s\"\n",
- RequestMethodStr[entry->method], url);
+ RequestMethodStr[orig_request->method], url);
debug(11, 10, "proxyhttpStart: HTTP request header:\n%s\n",
entry->mem_obj->mime_hdr);
comm_add_close_handler(sock,
httpStateFree,
(void *) httpState);
- request->method = entry->method;
+ request->method = orig_request->method;
xstrncpy(request->host, e->host, SQUIDHOSTNAMELEN);
request->port = e->http_port;
xstrncpy(request->urlpath, url, MAX_URL);
/*
- * $Id: neighbors.cc,v 1.99 1996/12/18 18:35:33 wessels Exp $
+ * $Id: neighbors.cc,v 1.100 1996/12/19 21:24:15 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
int
neighborsUdpPing(protodispatch_data * proto)
{
- char *host = proto->request->host;
+ request_t *request = proto->request;
+ char *host = request->host;
char *url = proto->url;
StoreEntry *entry = proto->entry;
const ipcache_addrs *ia = NULL;
if (squid_curtime - e->last_fail_time < 60)
continue;
- if (!edgeWouldBePinged(e, proto->request))
+ if (!edgeWouldBePinged(e, request))
continue; /* next edge */
if (e->options & NEIGHBOR_NO_QUERY)
continue;
/* the case below seems strange, but can happen if the
* URL host is on the other side of a firewall */
if (e->type == EDGE_SIBLING)
- if (!BIT_TEST(proto->request->flags, REQ_HIERARCHICAL))
+ if (!BIT_TEST(request->flags, REQ_HIERARCHICAL))
continue;
debug(15, 4, "neighborsUdpPing: pinging cache %s for '%s'\n",
e->host, url);
-
- if (BIT_TEST(entry->flag, KEY_PRIVATE))
- reqnum = atoi(entry->key);
- else
- reqnum = getKeyCounter();
+ reqnum = storeReqnum(entry, request);
debug(15, 3, "neighborsUdpPing: key = '%s'\n", entry->key);
debug(15, 3, "neighborsUdpPing: reqnum = %d\n", reqnum);
flags = 0;
/* check if we should set ICP_FLAG_HIT_OBJ */
if (opt_udp_hit_obj)
- if (!BIT_TEST(proto->request->flags, REQ_NOCACHE))
+ if (!BIT_TEST(request->flags, REQ_NOCACHE))
if (e->icp_version == ICP_VERSION_2)
flags |= ICP_FLAG_HIT_OBJ;
query = icpCreateMessage(ICP_OP_QUERY, flags, url, reqnum, 0);
/*
- * $Id: store.cc,v 1.181 1996/12/17 07:16:58 wessels Exp $
+ * $Id: store.cc,v 1.182 1996/12/19 21:24:17 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
static void storeSetPrivateKey _PARAMS((StoreEntry *));
static void storeDoRebuildFromDisk _PARAMS((void *data));
static void storeRebuiltFromDisk _PARAMS((struct storeRebuild_data * data));
+static unsigned int getKeyCounter _PARAMS((void));
/* Now, this table is inaccessible to outsider. They have to use a method
* to access a value in internal storage data structure. */
getKeyCounter(void)
{
static unsigned int key_counter = 0;
- if (++key_counter == 0)
- ++key_counter;
+ if (++key_counter == (1<<24))
+ key_counter = 1;
return key_counter;
}
+unsigned int
+storeReqnum(StoreEntry * entry, method_t method)
+{
+ if (BIT_TEST(entry->flag, KEY_PRIVATE))
+ return atoi(entry->key);
+ if (method == METHOD_GET)
+ return getKeyCounter();
+ return (method << 24) | getKeyCounter();
+}
+
const char *
storeGeneratePrivateKey(const char *url, method_t method, int num)
{
if (num == 0)
num = getKeyCounter();
+ else if (num & 0xFF000000) {
+ method = (method_t) (num >> 24);
+ num &= 0x00FFFFFF;
+ }
debug(20, 3, "storeGeneratePrivateKey: '%s'\n", url);
key_temp_buffer[0] = '\0';
sprintf(key_temp_buffer, "%d/%s/%s",
/* NOTREACHED */
break;
case METHOD_POST:
- sprintf(key_temp_buffer, "/post/%s", url);
- return key_temp_buffer;
- /* NOTREACHED */
- break;
case METHOD_PUT:
- sprintf(key_temp_buffer, "/put/%s", url);
- return key_temp_buffer;
- /* NOTREACHED */
- break;
case METHOD_HEAD:
- sprintf(key_temp_buffer, "/head/%s", url);
- return key_temp_buffer;
- /* NOTREACHED */
- break;
case METHOD_CONNECT:
- sprintf(key_temp_buffer, "/connect/%s", url);
- return key_temp_buffer;
- /* NOTREACHED */
- break;
case METHOD_TRACE:
- sprintf(key_temp_buffer, "/trace/%s", url);
+ sprintf(key_temp_buffer, "/%s/%s", RequestMethodStr[method], url);
return key_temp_buffer;
/* NOTREACHED */
break;