]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
fix TRACE mode.
authorwessels <>
Fri, 20 Dec 1996 04:24:13 +0000 (04:24 +0000)
committerwessels <>
Fri, 20 Dec 1996 04:24:13 +0000 (04:24 +0000)
Use high byte of reqnum as key for the request method

src/http.cc
src/neighbors.cc
src/store.cc

index 6f676ea573a2a8c5a6a48b010e1311c6ae9ef8e3..205c3fdf21a820812a6f248fcf174cae22f45251 100644 (file)
@@ -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);
index 028348e5f1dcaf0e80a83186a8a667d03b18bf55..8c7735b01256ea7b74efead3e6db3b27b853d60a 100644 (file)
@@ -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);
index aaf8f96513551d5b02057bcba36405e3c42d856c..f2636445b0569a5e15dda684af561a58b19057e9 100644 (file)
@@ -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;