]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
In storeComplete(), call InvokeHandlers() AFTER setting all the statuses.
authorwessels <>
Fri, 23 May 1997 11:20:57 +0000 (11:20 +0000)
committerwessels <>
Fri, 23 May 1997 11:20:57 +0000 (11:20 +0000)
src/http.cc
src/squid.h
src/store.cc
src/wais.cc

index 9bc243de56b96b9405888625bc46800d2c11f6be..03e98f7b08e8a1c8b3cdbafef5eb2370f426aab3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: http.cc,v 1.163 1997/05/22 17:28:51 wessels Exp $
+ * $Id: http.cc,v 1.164 1997/05/23 05:20:57 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -842,7 +842,7 @@ proxyhttpStart(request_t * orig_request,
     debug(11, 3, "proxyhttpStart: \"%s %s\"\n",
        RequestMethodStr[orig_request->method], entry->url);
     debug(11, 10, "proxyhttpStart: HTTP request header:\n%s\n",
-       entry->mem_obj->mime_hdr);
+       entry->mem_obj->request_hdr);
     if (e->options & NEIGHBOR_PROXY_ONLY)
 #if DONT_USE_VM
        storeReleaseRequest(entry);
@@ -864,8 +864,8 @@ proxyhttpStart(request_t * orig_request,
     storeLockObject(entry);
     httpState = xcalloc(1, sizeof(HttpStateData));
     httpState->entry = entry;
-    httpState->req_hdr = entry->mem_obj->mime_hdr;
-    httpState->req_hdr_sz = entry->mem_obj->mime_hdr_sz;
+    httpState->req_hdr = entry->mem_obj->request_hdr;
+    httpState->req_hdr_sz = entry->mem_obj->request_hdr_sz;
     request = get_free_request_t();
     httpState->request = requestLink(request);
     httpState->neighbor = e;
@@ -932,16 +932,12 @@ httpConnectDone(int fd, int status, void *data)
 }
 
 void
-httpStart(request_t * request,
-    char *req_hdr,
-    int req_hdr_sz,
-    StoreEntry * entry)
+httpStart(request_t * request, StoreEntry * entry)
 {
     int fd;
     HttpStateData *httpState;
     debug(11, 3, "httpStart: \"%s %s\"\n",
        RequestMethodStr[request->method], entry->url);
-    debug(11, 10, "httpStart: req_hdr '%s'\n", req_hdr);
     /* Create socket. */
     fd = comm_open(SOCK_STREAM,
        0,
@@ -957,8 +953,8 @@ httpStart(request_t * request,
     storeLockObject(entry);
     httpState = xcalloc(1, sizeof(HttpStateData));
     httpState->entry = entry;
-    httpState->req_hdr = req_hdr;
-    httpState->req_hdr_sz = req_hdr_sz;
+    httpState->req_hdr = entry->mem_obj->request_hdr;
+    httpState->req_hdr_sz = entry->mem_obj->request_hdr_sz;
     httpState->request = requestLink(request);
     httpState->fd = fd;
     comm_add_close_handler(httpState->fd,
index 710f431c946c9868824843bd9038cdb57436f6c2..1232175af3bdf5b33e0baa1824fbee2d631bb431 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.116 1997/05/22 15:51:59 wessels Exp $
+ * $Id: squid.h,v 1.117 1997/05/23 05:21:00 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -358,7 +358,7 @@ extern char ThisCache[];    /* main.c */
 
 extern void start_announce _PARAMS((void *unused));
 extern void sslStart _PARAMS((int fd, const char *, request_t *, char *, int *sz));
-extern void waisStart _PARAMS((method_t, char *, StoreEntry *));
+extern void waisStart _PARAMS((method_t, StoreEntry *));
 extern void storeDirClean _PARAMS((void *unused));
 extern void passStart _PARAMS((int fd,
        const char *url,
index ed79d44bce1082210e9d26afdfac2a195669cf8d..e8a16c216231950363a302b643a4f35dd90ea95d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.240 1997/05/22 23:16:40 wessels Exp $
+ * $Id: store.cc,v 1.241 1997/05/23 05:21:02 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -365,7 +365,7 @@ destroy_MemObject(MemObject * mem)
     debug(20, 3, "destroy_MemObject: destroying %p\n", mem);
     destroy_MemObjectData(mem);
     safe_free(mem->clients);
-    safe_free(mem->mime_hdr);
+    safe_free(mem->request_hdr);
     safe_free(mem->reply);
     safe_free(mem->e_abort_msg);
     requestUnlink(mem->request);
@@ -754,10 +754,10 @@ storeCreateEntry(const char *url,
     meta_data.url_strings += strlen(url);
     e->method = method;
     if (req_hdr) {
-       mem->mime_hdr_sz = req_hdr_sz;
-       mem->mime_hdr = xmalloc(req_hdr_sz + 1);
-       xmemcpy(mem->mime_hdr, req_hdr, req_hdr_sz);
-       *(mem->mime_hdr + req_hdr_sz) = '\0';
+       mem->request_hdr_sz = req_hdr_sz;
+       mem->request_hdr = xmalloc(req_hdr_sz + 1);
+       xmemcpy(mem->request_hdr, req_hdr, req_hdr_sz);
+       *(mem->request_hdr + req_hdr_sz) = '\0';
     }
     if (BIT_TEST(flags, REQ_CACHABLE)) {
        BIT_SET(e->flag, ENTRY_CACHABLE);
@@ -949,20 +949,11 @@ storeStartDeleteBehind(StoreEntry * e)
 
 /* Append incoming data from a primary server to an entry. */
 void
-storeAppend(StoreEntry * e, const char *data, int len)
+storeAppend(StoreEntry * e, const char *buf, int len)
 {
-    MemObject *mem;
-    /* sanity check */
-    if (e == NULL) {
-       debug_trap("storeAppend: NULL entry.");
-       return;
-    } else if ((mem = e->mem_obj) == NULL) {
-       debug_trap("storeAppend: NULL entry->mem_obj");
-       return;
-    } else if (mem->data == NULL) {
-       debug_trap("storeAppend: NULL entry->mem_obj->data");
-       return;
-    }
+    MemObject *mem = e->mem_obj;
+    assert(mem != NULL);
+    assert(len >= 0);
     if (len) {
        debug(20, 5, "storeAppend: appending %d bytes for '%s'\n", len, e->key);
        storeGetMemSpace(len);
@@ -971,7 +962,7 @@ storeAppend(StoreEntry * e, const char *data, int len)
                storeStartDeleteBehind(e);
        }
        store_mem_size += len;
-       (void) memAppend(mem->data, data, len);
+       memAppend(mem->data, buf, len);
        mem->e_current_len += len;
     }
     if (e->store_status != STORE_ABORTED && !BIT_TEST(e->flag, DELAY_SENDING))
@@ -1669,12 +1660,12 @@ storeComplete(StoreEntry * e)
 {
     debug(20, 3, "storeComplete: '%s'\n", e->key);
     e->object_len = e->mem_obj->e_current_len;
-    InvokeHandlers(e);
     e->lastref = squid_curtime;
     e->store_status = STORE_OK;
     storeSetMemStatus(e, IN_MEMORY);
     e->swap_status = NO_SWAP;
-    safe_free(e->mem_obj->mime_hdr);
+    InvokeHandlers(e);
+    safe_free(e->mem_obj->request_hdr);
     if (BIT_TEST(e->flag, RELEASE_REQUEST))
        storeRelease(e);
     else if (storeCheckSwapable(e))
index ab018d63d44bddef67b68a48689193846fdf048f..f00fffe804167f0258f83fed1145ca006e5e312b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.70 1997/05/15 23:38:02 wessels Exp $
+ * $Id: wais.cc,v 1.71 1997/05/23 05:21:04 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -114,7 +114,7 @@ typedef struct {
     method_t method;
     char *relayhost;
     int relayport;
-    char *mime_hdr;
+    char *request_hdr;
     char request[MAX_URL];
     int ip_lookup_pending;
 } WaisStateData;
@@ -277,14 +277,14 @@ waisSendRequest(int fd, void *data)
 
     if (Method)
        len += strlen(Method);
-    if (waisState->mime_hdr)
-       len += strlen(waisState->mime_hdr);
+    if (waisState->request_hdr)
+       len += strlen(waisState->request_hdr);
 
     buf = xcalloc(1, len + 1);
 
-    if (waisState->mime_hdr)
+    if (waisState->request_hdr)
        sprintf(buf, "%s %s %s\r\n", Method, waisState->request,
-           waisState->mime_hdr);
+           waisState->request_hdr);
     else
        sprintf(buf, "%s %s\r\n", Method, waisState->request);
     debug(24, 6, "waisSendRequest: buf: %s\n", buf);
@@ -299,13 +299,12 @@ waisSendRequest(int fd, void *data)
 }
 
 void
-waisStart(method_t method, char *mime_hdr, StoreEntry * entry)
+waisStart(method_t method, StoreEntry * entry)
 {
     WaisStateData *waisState = NULL;
     int fd;
     char *url = entry->url;
     debug(24, 3, "waisStart: \"%s %s\"\n", RequestMethodStr[method], url);
-    debug(24, 4, "            header: %s\n", mime_hdr);
     if (!Config.Wais.relayHost) {
        debug(24, 0, "waisStart: Failed because no relay host defined!\n");
        squid_error_entry(entry, ERR_NO_RELAY, NULL);
@@ -326,7 +325,7 @@ waisStart(method_t method, char *mime_hdr, StoreEntry * entry)
     waisState->method = method;
     waisState->relayhost = Config.Wais.relayHost;
     waisState->relayport = Config.Wais.relayPort;
-    waisState->mime_hdr = mime_hdr;
+    waisState->request_hdr = entry->mem_obj->request_hdr;
     waisState->fd = fd;
     waisState->entry = entry;
     xstrncpy(waisState->request, url, MAX_URL);