/*
- * $Id: client_side.cc,v 1.142 1997/11/05 19:52:22 wessels Exp $
+ * $Id: client_side.cc,v 1.143 1997/11/10 20:54:30 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
oldentry->mem_obj->request = requestLink(mem->request);
unlink_request = 1;
}
- memcpy(oldentry->mem_obj->reply, entry->mem_obj->reply, sizeof(struct _http_reply));
+ /* Don't memcpy() the whole reply structure here. For example,
+ * www.thegist.com (Netscape/1.13) returns a content-length for
+ * 304's which seems to be the length of the 304 HEADERS!!! and
+ * not the body they refer to. */
+ storeCopyNotModifiedReplyHeaders(entry->mem_obj, oldentry->mem_obj);
storeTimestampsSet(oldentry);
storeUnregister(entry, http);
storeUnlockObject(entry);
{
StoreEntry *entry = http->entry;
MemObject *mem = NULL;
-
if (entry == NULL)
return 0;
if (entry->store_status != STORE_PENDING)
return 0;
if (mem->reply->content_length == 0)
return 0;
+ assert(http->out.offset <= mem->reply->content_length + mem->reply->hdr_sz);
if (http->out.offset >= mem->reply->content_length + mem->reply->hdr_sz)
return 1;
return 0;
extern void storeMemObjectDump(MemObject * mem);
extern const char *storeUrl(const StoreEntry *);
extern void storeCreateMemObject(StoreEntry *, const char *, const char *);
+extern void storeCopyNotModifiedReplyHeaders(MemObject * O, MemObject * N);
/* storeKey stuff */
extern const cache_key *storeKeyDup(const cache_key *);
/*
- * $Id: store.cc,v 1.336 1997/11/05 20:00:57 wessels Exp $
+ * $Id: store.cc,v 1.337 1997/11/10 20:54:33 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
return;
e->mem_obj = new_MemObject(url, log_url);
}
+
+void
+storeCopyNotModifiedReplyHeaders(MemObject * oldmem, MemObject * newmem)
+{
+ http_reply *oldreply = oldmem->reply;
+ http_reply *newreply = newmem->reply;
+ oldreply->cache_control = newreply->cache_control;
+ oldreply->misc_headers = newreply->misc_headers;
+ if (newreply->date > -1)
+ oldreply->date = newreply->date;
+ if (newreply->last_modified > -1)
+ oldreply->last_modified = newreply->last_modified;
+ if (newreply->expires > -1)
+ oldreply->expires = newreply->expires;
+}