/*
- * $Id: cache_manager.cc,v 1.32 2005/09/10 16:03:52 serassio Exp $
+ * $Id: cache_manager.cc,v 1.33 2005/09/10 19:31:31 serassio Exp $
*
* DEBUG: section 16 Cache Manager Objects
* AUTHOR: Duane Wessels
a = cachemgrFindAction(mgr->action);
assert(a != NULL);
- if (a->flags.atomic)
- storeBuffer(entry);
+ storeBuffer(entry);
{
HttpVersion version(1,0);
a->handler(entry);
- if (a->flags.atomic) {
- storeBufferFlush(entry);
+ storeBufferFlush(entry);
+
+ if (a->flags.atomic)
entry->complete();
- }
cachemgrStateFree(mgr);
}
/*
- * $Id: ftp.cc,v 1.365 2005/09/10 16:03:52 serassio Exp $
+ * $Id: ftp.cc,v 1.366 2005/09/10 19:31:31 serassio Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
char *dirup;
int i, j, k;
const char *title = ftpState->title_url.buf();
- storeBuffer(e);
storeAppendPrintf(e, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
storeAppendPrintf(e, "<!-- HTML listing generated by Squid %s -->\n",
version_string);
storeAppendPrintf(e, "<PRE>\n");
dirup = ftpHtmlifyListEntry("<internal-dirup>", ftpState);
storeAppend(e, dirup, strlen(dirup));
- storeBufferFlush(e);
ftpState->flags.html_header_sent = 1;
}
getMyHostname(),
visible_appname_string);
storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
- storeBufferFlush(e);
}
static const char *Month[] =
debug(9, 3) ("ftpParseListing: %lu bytes to play with\n", (unsigned long int)len);
line = (char *)memAllocate(MEM_4K_BUF);
end++;
- storeBuffer(e);
+ storeBuffer(e); /* released when done processing current data payload */
s = sbuf;
s += strspn(s, crlf);
storeAppend(e, t, strlen(t));
}
- storeBufferFlush(e);
assert(usable <= len);
if (usable < len) {
ftpState->data.offset = 0;
}
+ storeBufferFlush(entry);
+
/* XXX what about Config.Timeout.read? */
read_sz = ftpState->data.size - ftpState->data.offset;
errorAppendEntry(ftpState->entry, err);
- storeBufferFlush(ftpState->entry);
-
ftpSendQuit(ftpState);
}
EBIT_CLR(e->flags, ENTRY_FWD_HDR_WAIT);
+ storeBuffer(e); /* released when done processing current data payload */
+
filename = (t = urlpath.rpos('/')) ? t + 1 : urlpath.buf();
if (ftpState->flags.isdir) {
}
}
- storeBuffer(e);
reply = httpReplyCreate();
/* set standard stuff */
httpReplySwapOut(reply, e);
- storeBufferFlush(e);
-
storeTimestampsSet(e);
if (ftpState->flags.authenticated) {
/*
- * $Id: gopher.cc,v 1.188 2005/09/10 16:03:52 serassio Exp $
+ * $Id: gopher.cc,v 1.189 2005/09/10 19:31:31 serassio Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
* OK. We successfully reach remote site. Start MIME typing
* stuff. Do it anyway even though request is not HTML type.
*/
+ storeBuffer(entry);
+
gopherMimeCreate(gopherState);
switch (gopherState->type_id) {
case GOPHER_DIRECTORY:
/* we got to convert it first */
- storeBuffer(entry);
gopherState->conversion = gopher_ds::HTML_DIR;
gopherState->HTML_header_added = 0;
break;
case GOPHER_INDEX:
/* we got to convert it first */
- storeBuffer(entry);
gopherState->conversion = gopher_ds::HTML_INDEX_RESULT;
gopherState->HTML_header_added = 0;
break;
case GOPHER_CSO:
/* we got to convert it first */
- storeBuffer(entry);
gopherState->conversion = gopher_ds::HTML_CSO_RESULT;
gopherState->cso_recno = 0;
gopherState->HTML_header_added = 0;
default:
gopherState->conversion = gopher_ds::NORMAL;
+ storeBufferFlush(entry);
}
/* Schedule read reply. */
/*
- * $Id: store.cc,v 1.578 2005/01/03 16:08:26 robertc Exp $
+ * $Id: store.cc,v 1.579 2005/09/10 19:31:31 serassio Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
void
storeBufferFlush(StoreEntry * e)
{
- EBIT_CLR(e->flags, DELAY_SENDING);
- InvokeHandlers(e);
+ if (EBIT_TEST(e->flags, DELAY_SENDING)) {
+ EBIT_CLR(e->flags, DELAY_SENDING);
+ InvokeHandlers(e);
+ }
}
ssize_t
/*
- * $Id: whois.cc,v 1.29 2005/09/10 16:03:52 serassio Exp $
+ * $Id: whois.cc,v 1.30 2005/09/10 19:31:31 serassio Exp $
*
* DEBUG: section 75 WHOIS protocol
* AUTHOR: Duane Wessels, Kostas Anagnostakis
WhoisState::setReplyToOK(StoreEntry *entry)
{
HttpReply *reply = httpReplyCreate();
+ storeBuffer(entry);
HttpVersion version(1, 0);
- httpReplySetHeaders(reply, version, HTTP_OK, NULL, NULL, 0, 0, -1);
+ httpReplySetHeaders(reply, version, HTTP_OK, "Gatewaying", "text/plain", -1, -1, -2);
storeEntryReplaceObject (entry, reply);
}
storeAppend(entry, buf, len);
+ storeBufferFlush(entry);
+
do_next_read = 1;
} else if (flag != COMM_OK || len < 0) {
debug(50, 2) ("whoisReadReply: FD %d: read failure: %s.\n",