From: wessels <> Date: Fri, 20 Dec 1996 04:24:13 +0000 (+0000) Subject: fix TRACE mode. X-Git-Tag: SQUID_3_0_PRE1~5264 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2cc3f72052b685a9c2b0be1b003aa25a24e342dc;p=thirdparty%2Fsquid.git fix TRACE mode. Use high byte of reqnum as key for the request method --- diff --git a/src/http.cc b/src/http.cc index 6f676ea573..205c3fdf21 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -888,7 +888,7 @@ proxyhttpStart(const char *url, 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); @@ -919,7 +919,7 @@ proxyhttpStart(const char *url, 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); diff --git a/src/neighbors.cc b/src/neighbors.cc index 028348e5f1..8c7735b012 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -414,7 +414,8 @@ neighbors_open(int fd) 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; @@ -451,23 +452,19 @@ neighborsUdpPing(protodispatch_data * proto) 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); @@ -484,7 +481,7 @@ neighborsUdpPing(protodispatch_data * proto) 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); diff --git a/src/store.cc b/src/store.cc index aaf8f96513..f2636445b0 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $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 @@ -240,6 +240,7 @@ static void storeHashMemDelete _PARAMS((StoreEntry *)); 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. */ @@ -621,16 +622,30 @@ unsigned int 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", @@ -650,27 +665,11 @@ storeGeneratePublicKey(const char *url, method_t method) /* 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;