with storeBuffer() and storeBufferFlush().
/*
- * $Id: ftp.cc,v 1.170 1997/11/18 00:48:23 wessels Exp $
+ * $Id: ftp.cc,v 1.171 1997/11/18 01:02:37 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
{
StoreEntry *e = ftpState->entry;
wordlist *w;
+ storeBuffer(e);
storeAppendPrintf(e, "<!-- HTML listing generated by Squid %s -->\n",
version_string);
storeAppendPrintf(e, "<!-- %s -->\n", mkrfc1123(squid_curtime));
storeAppendPrintf(e, "FTP Directory: %s\n", ftpState->title_url);
storeAppendPrintf(e, "</H2>\n");
storeAppendPrintf(e, "<PRE>\n");
+ storeBufferFlush(e);
EBIT_SET(ftpState->flags, FTP_HTML_HEADER_SENT);
}
ftpListingFinish(FtpStateData * ftpState)
{
StoreEntry *e = ftpState->entry;
+ storeBuffer(e);
storeAppendPrintf(e, "</PRE>\n");
storeAppendPrintf(e, "<HR>\n");
storeAppendPrintf(e, "<ADDRESS>\n");
version_string,
getMyHostname());
storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
+ storeBufferFlush(e);
}
static const char *Month[] =
end++;
/* XXX there is an ABR bug here. We need to make sure buf is
* NULL terminated */
+ storeBuffer(e);
for (s = buf; s < end; s += strcspn(s, crlf), s += strspn(s, crlf)) {
linelen = strcspn(s, crlf) + 1;
if (linelen > 4096)
assert(t != NULL);
storeAppend(e, t, strlen(t));
}
+ storeBufferFlush(e);
assert(usable <= len);
if (usable < len) {
/* must copy partial line to beginning of buf */
ftpReadComplete(ftpState);
} else {
if (EBIT_TEST(ftpState->flags, FTP_ISDIR)) {
- EBIT_SET(entry->flag, DELAY_SENDING);
ftpParseListing(ftpState, len);
- EBIT_CLR(entry->flag, DELAY_SENDING);
InvokeHandlers(entry);
} else {
assert(ftpState->data.offset == 0);
mime_type = mimeGetContentType(filename);
mime_enc = mimeGetContentEncoding(filename);
}
- EBIT_SET(e->flag, DELAY_SENDING);
+ storeBuffer(e);
storeAppendPrintf(e, "HTTP/1.0 200 Gatewaying\r\n");
reply->code = 200;
reply->version = 1.0;
storeAppendPrintf(e, "Last-Modified: %s\r\n", mkrfc1123(ftpState->mdtm));
reply->last_modified = ftpState->mdtm;
}
- EBIT_CLR(e->flag, DELAY_SENDING);
storeAppendPrintf(e, "\r\n");
+ storeBufferFlush(e);
reply->hdr_sz = e->mem_obj->inmem_hi;
storeTimestampsSet(e);
storeSetPublicKey(e);
/*
- * $Id: gopher.cc,v 1.113 1997/11/14 17:21:19 wessels Exp $
+ * $Id: gopher.cc,v 1.114 1997/11/18 01:02:38 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
"<ISINDEX></BODY></HTML>\n", storeUrl(entry), storeUrl(entry));
storeAppend(entry, outbuf, strlen(outbuf));
/* now let start sending stuff to client */
- EBIT_CLR(entry->flag, DELAY_SENDING);
+ storeBufferFlush(entry);
gopherState->data_in = 1;
return;
storeAppend(entry, outbuf, strlen(outbuf));
/* now let start sending stuff to client */
- EBIT_CLR(entry->flag, DELAY_SENDING);
+ storeBufferFlush(entry);
gopherState->data_in = 1;
return;
if ((int) strlen(outbuf) > 0) {
storeAppend(entry, outbuf, strlen(outbuf));
/* now let start sending stuff to client */
- EBIT_CLR(entry->flag, DELAY_SENDING);
+ storeBufferFlush(entry);
}
return;
}
if (gopherState->conversion != NORMAL)
gopherEndHTML(data);
storeTimestampsSet(entry);
- EBIT_CLR(entry->flag, DELAY_SENDING);
+ storeBufferFlush(entry);
storeComplete(entry);
comm_close(fd);
} else {
switch (gopherState->type_id) {
case GOPHER_DIRECTORY:
/* we got to convert it first */
- EBIT_SET(entry->flag, DELAY_SENDING);
+ storeBuffer(entry);
gopherState->conversion = HTML_DIR;
gopherState->HTML_header_added = 0;
break;
case GOPHER_INDEX:
/* we got to convert it first */
- EBIT_SET(entry->flag, DELAY_SENDING);
+ storeBuffer(entry);
gopherState->conversion = HTML_INDEX_RESULT;
gopherState->HTML_header_added = 0;
break;
case GOPHER_CSO:
/* we got to convert it first */
- EBIT_SET(entry->flag, DELAY_SENDING);
+ storeBuffer(entry);
gopherState->conversion = HTML_CSO_RESULT;
gopherState->cso_recno = 0;
gopherState->HTML_header_added = 0;
extern const char *storeUrl(const StoreEntry *);
extern void storeCreateMemObject(StoreEntry *, const char *, const char *);
extern void storeCopyNotModifiedReplyHeaders(MemObject * O, MemObject * N);
+extern void storeBuffer(StoreEntry *);
+extern void storeBufferFlush(StoreEntry *);
/* storeKey stuff */
extern const cache_key *storeKeyDup(const cache_key *);
/*
- * $Id: stat.cc,v 1.173 1997/11/15 06:36:36 wessels Exp $
+ * $Id: stat.cc,v 1.174 1997/11/18 01:02:40 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
if ((++N & 0xFF) == 0) {
debug(18, 3) ("stat_objects_get: Processed %d objects...\n", N);
}
- EBIT_SET(sentry->flag, DELAY_SENDING);
+ storeBuffer(sentry);
storeAppendPrintf(sentry, "KEY %s\n", storeKeyText(entry->key));
storeAppendPrintf(sentry, "\t%s %s\n",
RequestMethodStr[entry->method], storeUrl(entry));
storeAppendPrintf(sentry, "\t\tswapin_fd: %d\n",
(int) sc->swapin_fd);
}
- EBIT_CLR(sentry->flag, DELAY_SENDING);
storeAppendPrintf(sentry, "\n");
+ storeBufferFlush(sentry);
}
}
A.select_loops /= N;
A.cputime /= N;
}
- EBIT_SET(sentry->flag, DELAY_SENDING);
+ storeBuffer(sentry);
storeAppendPrintf(sentry, "client_http.requests = %d\n", A.client_http.requests);
storeAppendPrintf(sentry, "client_http.hits = %d\n", A.client_http.hits);
storeAppendPrintf(sentry, "client_http.errors = %d\n", A.client_http.errors);
storeAppendPrintf(sentry, "unlink.requests = %d\n", A.unlink.requests);
storeAppendPrintf(sentry, "page_faults = %d\n", A.page_faults);
storeAppendPrintf(sentry, "select_loops = %d\n", A.select_loops);
- EBIT_CLR(sentry->flag, DELAY_SENDING);
storeAppendPrintf(sentry, "cputime = %f seconds\n", A.cputime);
+ storeBufferFlush(sentry);
}
/*
- * $Id: store.cc,v 1.345 1997/11/18 00:48:46 wessels Exp $
+ * $Id: store.cc,v 1.346 1997/11/18 01:02:42 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
if (newreply->expires > -1)
oldreply->expires = newreply->expires;
}
+
+/* this just sets DELAY_SENDING */
+void
+storeBuffer(StoreEntry *e)
+{
+ EBIT_SET(e->flag, DELAY_SENDING);
+}
+
+/* this just clears DELAY_SENDING and Invokes the handlers */
+void
+storeBufferFlush(StoreEntry *e)
+{
+ EBIT_CLR(e->flag, DELAY_SENDING);
+ InvokeHandlers(e);
+}