httpReplyDestroy(), and other static httpReply*() functions.
/*
- * $Id: ESI.cc,v 1.18 2005/09/24 14:38:35 serassio Exp $
+ * $Id: ESI.cc,v 1.19 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
debug (86,5)("ESIContext::freeResources: Freeing for this=%p\n",this);
if (rep) {
- httpReplyDestroy(rep);
+ delete rep;
rep = NULL;
}
/*
- * $Id: ESIInclude.cc,v 1.7 2005/09/09 17:31:33 wessels Exp $
+ * $Id: ESIInclude.cc,v 1.8 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
} else {
if (rep) {
if (rep->sline.status != HTTP_OK) {
- httpReplyDestroy(rep);
+ delete rep;
rep = NULL;
esiStream->include->fail (esiStream);
esiStream->finished = 1;
#endif
- httpReplyDestroy(rep);
+ delete rep;
rep = NULL;
}
/*
- * $Id: HttpReply.cc,v 1.77 2005/09/17 05:50:07 wessels Exp $
+ * $Id: HttpReply.cc,v 1.78 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 58 HTTP Reply (Response)
* AUTHOR: Alex Rousskov
};
-/* local routines */
-static void httpReplyClean(HttpReply * rep);
-static void httpReplyDoDestroy(HttpReply * rep);
-static void httpReplyHdrCacheClean(HttpReply * rep);
-static time_t httpReplyHdrExpirationTime(const HttpReply * rep);
-
-
/* module initialization */
void
httpReplyInitModule(void)
}
-HttpReply *
-httpReplyCreate(void)
-{
- HttpReply *rep = new HttpReply;
- debug(58, 7) ("creating rep: %p\n", rep);
- return rep;
-}
-
HttpReply::HttpReply() : HttpMsg(hoReply), date (0), last_modified (0), expires (0), surrogate_control (NULL), content_range (NULL), keep_alive (0), protoPrefix("HTTP/")
{
- httpBodyInit(&body);
- hdrCacheInit();
- httpStatusLineInit(&sline);
-}
-
-void HttpReply::reset()
-{
- httpReplyReset(this);
+ init();
}
-static void
-httpReplyClean(HttpReply * rep)
+HttpReply::~HttpReply()
{
- assert(rep);
- httpBodyClean(&rep->body);
- httpReplyHdrCacheClean(rep);
- httpHeaderClean(&rep->header);
- httpStatusLineClean(&rep->sline);
+ if (do_clean)
+ clean();
}
void
-httpReplyDestroy(HttpReply * rep)
+HttpReply::init()
{
- assert(rep);
- debug(58, 7) ("destroying rep: %p\n", rep);
- httpReplyClean(rep);
- httpReplyDoDestroy(rep);
+ httpBodyInit(&body);
+ hdrCacheInit();
+ httpStatusLineInit(&sline);
+ do_clean = true;
}
-void
-httpReplyReset(HttpReply * rep)
+void HttpReply::reset()
{
+
// reset should not reset the protocol; could have made protoPrefix a
// virtual function instead, but it is not clear whether virtual methods
// are allowed with MEMPROXY_CLASS() and whether some cbdata void*
// conversions are not going to kill virtual tables
- const String pfx = rep->protoPrefix;
- httpReplyClean(rep);
- *rep = HttpReply();
- rep->protoPrefix = pfx;
+ const String pfx = protoPrefix;
+ clean();
+ init();
+ protoPrefix = pfx;
+}
+
+void
+HttpReply::clean()
+{
+ httpBodyClean(&body);
+ hdrCacheClean();
+ httpHeaderClean(&header);
+ httpStatusLineClean(&sline);
}
/* absorb: copy the contents of a new reply to the old one, destroy new one */
void
-httpReplyAbsorb(HttpReply * rep, HttpReply * new_rep)
+HttpReply::absorb(HttpReply * new_rep)
{
- assert(rep && new_rep);
- httpReplyClean(rep);
- *rep = *new_rep;
+ assert(new_rep);
+ clean();
+ *this = *new_rep;
new_rep->header.entries.clean();
/* cannot use Clean() on new reply now! */
+ new_rep->do_clean = false;
new_rep->cache_control = NULL; // helps with debugging
- httpReplyDoDestroy(new_rep);
+ delete new_rep;
}
/*
- * httpReplyParse takes character buffer of HTTP headers (buf),
+ * parse() takes character buffer of HTTP headers (buf),
* which may not be NULL-terminated, and fills in an HttpReply
* structure (rep). The parameter 'end' specifies the offset to
* the end of the reply headers. The caller may know where the
* returns true on success.
*/
bool
-httpReplyParse(HttpReply * rep, const char *buf, ssize_t end)
+HttpReply::parse(const char *buf, ssize_t end)
{
/*
* this extra buffer/copy will be eliminated when headers become
MemBuf mb;
int success;
/* reset current state, because we are not used in incremental fashion */
- httpReplyReset(rep);
+ reset();
/* put a string terminator. s is how many bytes to touch in
* 'buf' including the terminating NULL. */
mb.init();
mb.append(buf, end);
- mb.append("\0", 1);
- success = rep->httpMsgParseStep(mb.buf, 0);
+ mb.terminate();
+ success = httpMsgParseStep(mb.buf, 0);
mb.clean();
return success == 1;
}
void
-httpReplyPackHeadersInto(const HttpReply * rep, Packer * p)
+HttpReply::packHeadersInto(Packer * p) const
{
- assert(rep);
- httpStatusLinePackInto(&rep->sline, p);
- httpHeaderPackInto(&rep->header, p);
+ httpStatusLinePackInto(&sline, p);
+ httpHeaderPackInto(&header, p);
packerAppend(p, "\r\n", 2);
}
void
-httpReplyPackInto(const HttpReply * rep, Packer * p)
+HttpReply::packInto(Packer * p)
{
- httpReplyPackHeadersInto(rep, p);
- httpBodyPackInto(&rep->body, p);
+ packHeadersInto(p);
+ httpBodyPackInto(&body, p);
}
-/* create memBuf, create mem-based packer, pack, destroy packer, return MemBuf */
+/* create memBuf, create mem-based packer, pack, destroy packer, return MemBuf */
MemBuf *
-httpReplyPack(const HttpReply * rep)
+HttpReply::pack()
{
MemBuf *mb = new MemBuf;
Packer p;
- assert(rep);
mb->init();
packerToMemInit(&p, mb);
- httpReplyPackInto(rep, &p);
+ packInto(&p);
packerClean(&p);
return mb;
}
-/* swap: create swap-based packer, pack, destroy packer
+/*
+ * swap: create swap-based packer, pack, destroy packer
* This eats the reply.
*/
void
-httpReplySwapOut(HttpReply * rep, StoreEntry * e)
+HttpReply::swapOut(StoreEntry * e)
{
- assert(rep && e);
+ assert(e);
- storeEntryReplaceObject(e, rep);
+ storeEntryReplaceObject(e, this);
}
MemBuf *
httpPackedReply(HttpVersion ver, http_status status, const char *ctype,
int clen, time_t lmt, time_t expires)
{
- HttpReply *rep = httpReplyCreate();
- httpReplySetHeaders(rep, ver, status, ctype, NULL, clen, lmt, expires);
- MemBuf *mb = httpReplyPack(rep);
- httpReplyDestroy(rep);
+ HttpReply *rep = new HttpReply;
+ rep->setHeaders(ver, status, ctype, NULL, clen, lmt, expires);
+ MemBuf *mb = rep->pack();
+ delete rep;
return mb;
}
HttpReply *
-httpReplyMake304 (const HttpReply * rep)
+HttpReply::make304 () const
{
static const http_hdr_type ImsEntries[] = {HDR_DATE, HDR_CONTENT_TYPE, HDR_EXPIRES, HDR_LAST_MODIFIED, /* eof */ HDR_OTHER};
- HttpReply *rv;
+ HttpReply *rv = new HttpReply;
int t;
HttpHeaderEntry *e;
- assert(rep);
- rv = httpReplyCreate ();
/* rv->content_length; */
- rv->date = rep->date;
- rv->last_modified = rep->last_modified;
- rv->expires = rep->expires;
- rv->content_type = rep->content_type;
+ rv->date = date;
+ rv->last_modified = last_modified;
+ rv->expires = expires;
+ rv->content_type = content_type;
/* rv->cache_control */
/* rv->content_range */
/* rv->keep_alive */
HTTP_NOT_MODIFIED, "");
for (t = 0; ImsEntries[t] != HDR_OTHER; ++t)
- if ((e = httpHeaderFindEntry(&rep->header, ImsEntries[t])))
+ if ((e = httpHeaderFindEntry(&header, ImsEntries[t])))
httpHeaderAddEntry(&rv->header, httpHeaderEntryClone(e));
/* rv->body */
}
MemBuf *
-httpPacked304Reply(const HttpReply * rep)
+HttpReply::packed304Reply()
{
/* Not as efficient as skipping the header duplication,
* but easier to maintain
*/
- HttpReply *temp;
- assert (rep);
- temp = httpReplyMake304 (rep);
- MemBuf *rv = httpReplyPack(temp);
- httpReplyDestroy (temp);
+ HttpReply *temp = make304 ();
+ MemBuf *rv = temp->pack();
+ delete temp;
return rv;
}
void
-httpReplySetHeaders(HttpReply * reply, HttpVersion ver, http_status status, const char *reason,
- const char *ctype, int clen, time_t lmt, time_t expires)
+HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason,
+ const char *ctype, int clen, time_t lmt, time_t expires)
{
HttpHeader *hdr;
- assert(reply);
- httpStatusLineSet(&reply->sline, ver, status, reason);
- hdr = &reply->header;
+ httpStatusLineSet(&sline, ver, status, reason);
+ hdr = &header;
httpHeaderPutStr(hdr, HDR_SERVER, visible_appname_string);
httpHeaderPutStr(hdr, HDR_MIME_VERSION, "1.0");
httpHeaderPutTime(hdr, HDR_DATE, squid_curtime);
if (ctype) {
httpHeaderPutStr(hdr, HDR_CONTENT_TYPE, ctype);
- reply->content_type = ctype;
+ content_type = ctype;
} else
- reply->content_type = String();
+ content_type = String();
if (clen >= 0)
httpHeaderPutInt(hdr, HDR_CONTENT_LENGTH, clen);
if (lmt > 0) /* this used to be lmt != 0 @?@ */
httpHeaderPutTime(hdr, HDR_LAST_MODIFIED, lmt);
- reply->date = squid_curtime;
+ date = squid_curtime;
- reply->content_length = clen;
+ content_length = clen;
- reply->expires = expires;
+ expires = expires;
- reply->last_modified = lmt;
+ last_modified = lmt;
}
void
-httpRedirectReply(HttpReply * reply, http_status status, const char *loc)
+HttpReply::redirect(http_status status, const char *loc)
{
HttpHeader *hdr;
- assert(reply);
HttpVersion ver(1,0);
- httpStatusLineSet(&reply->sline, ver, status, httpStatusString(status));
- hdr = &reply->header;
+ httpStatusLineSet(&sline, ver, status, httpStatusString(status));
+ hdr = &header;
httpHeaderPutStr(hdr, HDR_SERVER, full_appname_string);
httpHeaderPutTime(hdr, HDR_DATE, squid_curtime);
httpHeaderPutInt(hdr, HDR_CONTENT_LENGTH, 0);
httpHeaderPutStr(hdr, HDR_LOCATION, loc);
- reply->date = squid_curtime;
- reply->content_length = 0;
+ date = squid_curtime;
+ content_length = 0;
}
/* compare the validators of two replies.
* 0 = they do not match
*/
int
-httpReplyValidatorsMatch(HttpReply const * rep, HttpReply const * otherRep)
+HttpReply::validatorsMatch(HttpReply const * otherRep) const
{
String one,two;
- assert (rep && otherRep);
+ assert (otherRep);
/* Numbers first - easiest to check */
/* Content-Length */
/* TODO: remove -1 bypass */
- if (rep->content_length != otherRep->content_length
- && rep->content_length > -1 &&
+ if (content_length != otherRep->content_length
+ && content_length > -1 &&
otherRep->content_length > -1)
return 0;
/* ETag */
- one = httpHeaderGetStrOrList(&rep->header, HDR_ETAG);
+ one = httpHeaderGetStrOrList(&header, HDR_ETAG);
two = httpHeaderGetStrOrList(&otherRep->header, HDR_ETAG);
return 0;
}
- if (rep->last_modified != otherRep->last_modified)
+ if (last_modified != otherRep->last_modified)
return 0;
/* MD5 */
- one = httpHeaderGetStrOrList(&rep->header, HDR_CONTENT_MD5);
+ one = httpHeaderGetStrOrList(&header, HDR_CONTENT_MD5);
two = httpHeaderGetStrOrList(&otherRep->header, HDR_CONTENT_MD5);
void
-HttpReply::httpReplyUpdateOnNotModified(HttpReply const * freshRep)
+HttpReply::updateOnNotModified(HttpReply const * freshRep)
{
assert(freshRep);
/* Can not update modified headers that don't match! */
- assert (httpReplyValidatorsMatch(this, freshRep));
+ assert (validatorsMatch(freshRep));
/* clean cache */
- httpReplyHdrCacheClean(this);
+ hdrCacheClean();
/* update raw headers */
httpHeaderUpdate(&header, &freshRep->header,
(const HttpHeaderMask *) &Denied304HeadersMask);
/* internal routines */
-/* internal function used by Destroy and Absorb */
-static void
-httpReplyDoDestroy(HttpReply * rep)
-{
- delete rep;
-}
-
-static time_t
-httpReplyHdrExpirationTime(const HttpReply * rep)
+time_t
+HttpReply::hdrExpirationTime()
{
/* The s-maxage and max-age directive takes priority over Expires */
- if (rep->cache_control) {
- if (rep->date >= 0) {
- if (rep->cache_control->s_maxage >= 0)
- return rep->date + rep->cache_control->s_maxage;
+ if (cache_control) {
+ if (date >= 0) {
+ if (cache_control->s_maxage >= 0)
+ return date + cache_control->s_maxage;
- if (rep->cache_control->max_age >= 0)
- return rep->date + rep->cache_control->max_age;
+ if (cache_control->max_age >= 0)
+ return date + cache_control->max_age;
} else {
/*
* Conservatively handle the case when we have a max-age
* header, but no Date for reference?
*/
- if (rep->cache_control->s_maxage >= 0)
+ if (cache_control->s_maxage >= 0)
return squid_curtime;
- if (rep->cache_control->max_age >= 0)
+ if (cache_control->max_age >= 0)
return squid_curtime;
}
}
if (Config.onoff.vary_ignore_expire &&
- httpHeaderHas(&rep->header, HDR_VARY)) {
- const time_t d = httpHeaderGetTime(&rep->header, HDR_DATE);
- const time_t e = httpHeaderGetTime(&rep->header, HDR_EXPIRES);
+ httpHeaderHas(&header, HDR_VARY)) {
+ const time_t d = httpHeaderGetTime(&header, HDR_DATE);
+ const time_t e = httpHeaderGetTime(&header, HDR_EXPIRES);
if (d == e)
return -1;
}
- if (httpHeaderHas(&rep->header, HDR_EXPIRES)) {
- const time_t e = httpHeaderGetTime(&rep->header, HDR_EXPIRES);
+ if (httpHeaderHas(&header, HDR_EXPIRES)) {
+ const time_t e = httpHeaderGetTime(&header, HDR_EXPIRES);
/*
* HTTP/1.0 says that robust implementations should consider
* bad or malformed Expires header as equivalent to "expires
content_type = String();
/* be sure to set expires after date and cache-control */
- expires = httpReplyHdrExpirationTime(this);
+ expires = hdrExpirationTime();
}
/* sync this routine when you update HttpReply struct */
-static void
-httpReplyHdrCacheClean(HttpReply * rep)
+void
+HttpReply::hdrCacheClean()
{
- rep->content_type.clean();
+ content_type.clean();
- if (rep->cache_control) {
- httpHdrCcDestroy(rep->cache_control);
- rep->cache_control = NULL;
+ if (cache_control) {
+ httpHdrCcDestroy(cache_control);
+ cache_control = NULL;
}
- if (rep->surrogate_control) {
- httpHdrScDestroy(rep->surrogate_control);
- rep->surrogate_control = NULL;
+ if (surrogate_control) {
+ httpHdrScDestroy(surrogate_control);
+ surrogate_control = NULL;
}
- if (rep->content_range) {
- httpHdrContRangeDestroy(rep->content_range);
- rep->content_range = NULL;
+ if (content_range) {
+ httpHdrContRangeDestroy(content_range);
+ content_range = NULL;
}
}
* Returns the body size of a HTTP response
*/
int
-httpReplyBodySize(method_t method, HttpReply const * reply)
+HttpReply::bodySize(method_t method) const
{
- if (reply->sline.version.major < 1)
+ if (sline.version.major < 1)
return -1;
else if (METHOD_HEAD == method)
return 0;
- else if (reply->sline.status == HTTP_OK)
+ else if (sline.status == HTTP_OK)
(void) 0; /* common case, continue */
- else if (reply->sline.status == HTTP_NO_CONTENT)
+ else if (sline.status == HTTP_NO_CONTENT)
return 0;
- else if (reply->sline.status == HTTP_NOT_MODIFIED)
+ else if (sline.status == HTTP_NOT_MODIFIED)
return 0;
- else if (reply->sline.status < HTTP_OK)
+ else if (sline.status < HTTP_OK)
return 0;
- return reply->content_length;
+ return content_length;
}
bool HttpReply::sanityCheckStartLine(MemBuf *buf, http_status *error)
/*
- * $Id: HttpReply.h,v 1.11 2005/09/15 20:19:41 wessels Exp $
+ * $Id: HttpReply.h,v 1.12 2005/11/05 00:08:32 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "HttpMsg.h"
#include "HttpStatusLine.h"
-/* Http Reply */
extern void httpReplyInitModule(void);
-/* create/destroy */
-extern HttpReply *httpReplyCreate(void);
-extern void httpReplyDestroy(HttpReply * rep);
-/* reset: clean, then init */
-extern void httpReplyReset(HttpReply * rep);
-/* absorb: copy the contents of a new reply to the old one, destroy new one */
-extern void httpReplyAbsorb(HttpReply * rep, HttpReply * new_rep);
-/* parse returns true on success */
-extern bool httpReplyParse(HttpReply * rep, const char *buf, ssize_t);
-extern void httpReplyPackHeadersInto(const HttpReply * rep, Packer * p);
-extern void httpReplyPackInto(const HttpReply * rep, Packer * p);
-/* ez-routines */
-/* mem-pack: returns a ready to use mem buffer with a packed reply */
-extern MemBuf *httpReplyPack(const HttpReply * rep);
-/* swap: create swap-based packer, pack, destroy packer */
-extern void httpReplySwapOut(HttpReply * rep, StoreEntry * e);
-/* set commonly used info with one call */
-extern void httpReplySetHeaders(HttpReply * rep, HttpVersion ver, http_status status,
- const char *reason, const char *ctype, int clen, time_t lmt, time_t expires);
/* do everything in one call: init, set, pack, clean, return MemBuf */
-extern MemBuf *httpPackedReply(HttpVersion ver, http_status status, const char *ctype,
- int clen, time_t lmt, time_t expires);
-/* construct 304 reply and pack it into MemBuf, return MemBuf */
-extern MemBuf *httpPacked304Reply(const HttpReply * rep);
-/* construct a 304 reply and return it */
-extern HttpReply *httpReplyMake304(const HttpReply *rep);
-/* header manipulation */
-extern int httpReplyContentLen(const HttpReply * rep);
-extern const char *httpReplyContentType(const HttpReply * rep);
-extern time_t httpReplyExpires(const HttpReply * rep);
-extern int httpReplyHasCc(const HttpReply * rep, http_hdr_cc_type type);
-extern void httpRedirectReply(HttpReply *, http_status, const char *);
-extern int httpReplyBodySize(method_t, HttpReply const *);
-extern int httpReplyValidatorsMatch (HttpReply const *, HttpReply const *);
-
+extern MemBuf *httpPackedReply(HttpVersion ver, http_status status, const char *ctype, int clen, time_t lmt, time_t expires);
/* Sync changes here with HttpReply.cc */
public:
MEMPROXY_CLASS(HttpReply);
HttpReply();
+ ~HttpReply();
virtual void reset();
HttpBody body; /* for small constant memory-resident text bodies only */
String protoPrefix; // e.g., "HTTP/"
+ bool do_clean;
public:
- void httpReplyUpdateOnNotModified(HttpReply const *other);
+ void updateOnNotModified(HttpReply const *other);
+ /* parse returns true on success */
+ bool parse(const char *buf, ssize_t);
+ /* absorb: copy the contents of a new reply to the old one, destroy new one */
+ void absorb(HttpReply * new_rep);
+ /* set commonly used info with one call */
+ void setHeaders(HttpVersion ver, http_status status,
+ const char *reason, const char *ctype, int clen, time_t lmt, time_t expires);
+ /* mem-pack: returns a ready to use mem buffer with a packed reply */
+ MemBuf *pack();
+ /* swap: create swap-based packer, pack, destroy packer */
+ void swapOut(StoreEntry * e);
+ /* construct a 304 reply and return it */
+ HttpReply *make304() const;
+
+ void redirect(http_status, const char *);
+ int bodySize(method_t) const;
+ int validatorsMatch (HttpReply const *other) const;
+ void packHeadersInto(Packer * p) const;
+
+private:
+ /* initialize */
+ void init();
+ void clean();
+ void hdrCacheClean();
+ void packInto(Packer * p);
+ /* ez-routines */
+ /* construct 304 reply and pack it into MemBuf, return MemBuf */
+ MemBuf *packed304Reply();
+ /* header manipulation */
+ time_t hdrExpirationTime();
protected:
virtual void packFirstLineInto(Packer * p, bool) const;
/*
- * $Id: MemObject.cc,v 1.17 2005/09/17 05:50:07 wessels Exp $
+ * $Id: MemObject.cc,v 1.18 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 19 Store Memory Primitives
* AUTHOR: Robert Collins
return stats.items_inuse;
}
-MemObject::MemObject(char const *aUrl, char const *aLog_url) :
- _reply (httpReplyCreate())
+MemObject::MemObject(char const *aUrl, char const *aLog_url)
{
+ _reply = new HttpReply;
url = xstrdup(aUrl);
#if URL_CHECKSUM_DEBUG
#endif
if (_reply)
- httpReplyDestroy((HttpReply *)_reply);
+ delete _reply;
requestUnlink(request);
/*
- * $Id: access_log.cc,v 1.106 2005/10/16 14:31:25 serassio Exp $
+ * $Id: access_log.cc,v 1.107 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
safe_free(aLogEntry->cache.authuser);
if (aLogEntry->reply) {
- httpReplyDestroy(aLogEntry->reply);
+ delete aLogEntry->reply;
aLogEntry->reply = NULL;
}
/*
- * $Id: cache_manager.cc,v 1.33 2005/09/10 19:31:31 serassio Exp $
+ * $Id: cache_manager.cc,v 1.34 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 16 Cache Manager Objects
* AUTHOR: Duane Wessels
httpHeaderPutAuth(&rep->header, "Basic", mgr->action);
/* store the reply */
- httpReplySwapOut(rep, entry);
+ rep->swapOut(entry);
entry->expires = squid_curtime;
{
HttpVersion version(1,0);
- HttpReply *rep = httpReplyCreate();
- httpReplySetHeaders(rep,
- version,
- HTTP_OK,
- NULL,
- "text/plain",
- -1, /* C-Len */
- squid_curtime, /* LMT */
- squid_curtime);
- httpReplySwapOut(rep, entry);
+ HttpReply *rep = new HttpReply;
+ rep->setHeaders(version,
+ HTTP_OK,
+ NULL,
+ "text/plain",
+ -1, /* C-Len */
+ squid_curtime, /* LMT */
+ squid_curtime);
+ rep->swapOut(entry);
}
a->handler(entry);
/*
- * $Id: cbdata.cc,v 1.64 2004/08/30 05:12:31 robertc Exp $
+ * $Id: cbdata.cc,v 1.65 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 45 Callback Data Registry
* ORIGINAL AUTHOR: Duane Wessels
/* TODO: examine making cbdata templated on this - so we get type
* safe access to data - RBC 20030902 */
void *data;
-void check() const { assert(cookie == ((long)this ^ Cookie));}
+void check(int line) const {assert(cookie == ((long)this ^ Cookie));}
size_t dataSize() const { return sizeof(data);}
debug(45, 3) ("cbdataFree: %p\n", p);
#endif
- c->check();
+ c->check(__LINE__);
assert(c->valid);
c->valid = 0;
#if CBDATA_DEBUG
#endif
- c->check();
+ c->check(__LINE__);
assert(c->locks < 65535);
#endif
- c->check();
+ c->check(__LINE__);
assert(c != NULL);
c = (cbdata *) (((char *) p) - cbdata::Offset);
- c->check();
+ c->check(__LINE__);
assert(c->locks > 0);
/*
- * $Id: client_side.cc,v 1.701 2005/10/23 15:52:17 hno Exp $
+ * $Id: client_side.cc,v 1.702 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
{
prepareReply(rep);
assert (rep);
- MemBuf *mb = httpReplyPack(rep);
+ MemBuf *mb = rep->pack();
/* Save length of headers for persistent conn checks */
http->out.headers_sz = mb->contentSize();
#if HEADERS_LOG
/*
- * $Id: client_side_reply.cc,v 1.88 2005/09/15 19:22:30 wessels Exp $
+ * $Id: client_side_reply.cc,v 1.89 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 88 Client-side Reply Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
/* This is a duplicate call through the HandleIMS code path.
* Can we guarantee we don't need it elsewhere?
*/
- if (!httpReplyValidatorsMatch(http->storeEntry()->getReply(),
- old_entry->getReply())) {
+ if (!http->storeEntry()->getReply()->validatorsMatch(old_entry->getReply())) {
debug(88, 5) ("clientGetsOldEntry: NO, Old object has been invalidated"
"by the new one\n");
return false;
* headers have been loaded from disk. */
http->logType = LOG_TCP_REFRESH_HIT;
- if (httpReplyValidatorsMatch(http->storeEntry()->getReply(),
- old_entry->getReply())) {
+ if (http->storeEntry()->getReply()->validatorsMatch(old_entry->getReply())) {
int unlink_request = 0;
if (old_entry->mem_obj->request == NULL) {
* not the body they refer to. */
HttpReply *old_rep = (HttpReply *) old_entry->getReply();
- old_rep->httpReplyUpdateOnNotModified(http->storeEntry()->getReply());
+ old_rep->updateOnNotModified(http->storeEntry()->getReply());
storeTimestampsSet(old_entry);
* Send the IMS reply to the client.
*/
sendClientUpstreamResponse();
- } else if (httpReplyValidatorsMatch (http->storeEntry()->getReply(),
- old_entry->getReply())) {
+ } else if (http->storeEntry()->getReply()->validatorsMatch(old_entry->getReply())) {
/* Our object is usable once updated */
/* the client did not ask for IMS, send the whole object
*/
if (HTTP_NOT_MODIFIED == http->storeEntry()->getReply()->sline.status) {
HttpReply *old_rep = (HttpReply *) old_entry->getReply();
- old_rep->httpReplyUpdateOnNotModified(http->storeEntry()->getReply());
+ old_rep->updateOnNotModified(http->storeEntry()->getReply());
storeTimestampsSet(old_entry);
http->logType = LOG_TCP_REFRESH_HIT;
}
sendMoreData(result);
} else {
time_t const timestamp = e->timestamp;
- HttpReply *temprep = httpReplyMake304 (e->getReply());
+ HttpReply *temprep = e->getReply()->make304();
http->logType = LOG_TCP_IMS_HIT;
removeClientStoreReference(&sc, http);
createStoreEntry(http->request->method,
* reply has a meaningful Age: header.
*/
e->timestamp = timestamp;
- httpReplySwapOut (temprep, e);
+ temprep->swapOut(e);
e->complete();
/* TODO: why put this in the store and then serialise it and then parse it again.
* Simply mark the request complete in our context and
triggerInitialStoreRead();
if (http->redirect.status) {
- HttpReply *rep = httpReplyCreate();
+ HttpReply *rep = new HttpReply;
#if LOG_TCP_REDIRECTS
http->logType = LOG_TCP_REDIRECT;
#endif
storeReleaseRequest(http->storeEntry());
- httpRedirectReply(rep, http->redirect.status,
- http->redirect.location);
- httpReplySwapOut(rep, http->storeEntry());
+ rep->redirect(http->redirect.status, http->redirect.location);
+ rep->swapOut(http->storeEntry());
http->storeEntry()->complete();
return;
}
triggerInitialStoreRead();
- r = httpReplyCreate();
+ r = new HttpReply;
HttpVersion version(1,0);
- httpReplySetHeaders(r, version, purgeStatus, NULL, NULL, 0, 0, -1);
+ r->setHeaders(version, purgeStatus, NULL, NULL, 0, 0, -1);
- httpReplySwapOut(r, http->storeEntry());
+ r->swapOut(http->storeEntry());
http->storeEntry()->complete();
}
tempBuffer, SendMoreData, this);
storeReleaseRequest(http->storeEntry());
storeBuffer(http->storeEntry());
- rep = httpReplyCreate();
+ rep = new HttpReply;
HttpVersion version(1,0);
- httpReplySetHeaders(rep, version, HTTP_OK, NULL, "text/plain",
- httpRequestPrefixLen(http->request), 0, squid_curtime);
- httpReplySwapOut(rep, http->storeEntry());
+ rep->setHeaders(version, HTTP_OK, NULL, "text/plain",
+ httpRequestPrefixLen(http->request), 0, squid_curtime);
+ rep->swapOut(http->storeEntry());
httpRequestSwapOut(http->request, http->storeEntry());
http->storeEntry()->complete();
}
debug(88, 5) ("clientReplyStatus: transfer is DONE\n");
/* Ok we're finished, but how? */
- if (httpReplyBodySize(http->request->method,
- http->storeEntry()->getReply()) < 0) {
+ if (http->storeEntry()->getReply()->bodySize(http->request->method) < 0) {
debug(88, 5) ("clientReplyStatus: closing, content_length < 0\n");
return STREAM_FAILED;
}
#endif
- if (httpReplyBodySize(request->method, holdingReply) < 0) {
+ if (holdingReply->bodySize(request->method) < 0) {
debug(88,
3)
("clientBuildReplyHeader: can't keep-alive, unknown body size\n");
if (!k)
return;
- holdReply(httpReplyCreate());
+ holdReply(new HttpReply);
- if (!httpReplyParse(holdingReply, buf, k)) {
+ if (!holdingReply->parse(buf, k)) {
/* parsing failure, get rid of the invalid reply */
- httpReplyDestroy(holdingReply);
+ delete holdingReply;
holdReply (NULL);
- /* This is wrong. httpReplyDestroy should to the rep
+ /* This is wrong. ~HttpReply() should to the rep
* for us, and we can destroy our own range info
*/
http->request);
removeClientStoreReference(&sc, http);
startError(err);
- httpReplyDestroy(rep);
+ delete rep;
return;
}
startError(err);
- httpReplyDestroy(rep);
+ delete rep;
http->logType = LOG_TCP_DENIED_REPLY;
/*
- * $Id: client_side_request.cc,v 1.49 2005/10/18 20:17:21 serassio Exp $
+ * $Id: client_side_request.cc,v 1.50 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
{
/** TODO: should be querying the stream. */
int contentLength =
- httpReplyBodySize(request->method, memObject()->getReply());
+ memObject()->getReply()->bodySize(request->method);
assert(contentLength >= 0);
if (out.offset < contentLength)
/*
- * $Id: errorpage.cc,v 1.204 2005/09/17 05:50:08 wessels Exp $
+ * $Id: errorpage.cc,v 1.205 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
* on 407/401 responses, and do not check the accel state on 401/407 responses
*/
authenticateFixHeader(rep, err->auth_user_request, err->request, 0, 1);
- httpReplySwapOut(rep, entry);
+ rep->swapOut(entry);
EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
storeBufferFlush(entry);
entry->complete();
rep = errorBuildReply(err);
- comm_old_write_mbuf(fd, httpReplyPack(rep), errorSendComplete, err);
+ comm_old_write_mbuf(fd, rep->pack(), errorSendComplete, err);
- httpReplyDestroy(rep);
+ delete rep;
}
/*
HttpReply *
errorBuildReply(ErrorState * err)
{
- HttpReply *rep = httpReplyCreate();
+ HttpReply *rep = new HttpReply;
const char *name = errorPageName(err->page_id);
/* no LMT for error pages; error pages expire immediately */
HttpVersion version(1, 0);
if (strchr(name, ':')) {
/* Redirection */
- httpReplySetHeaders(rep, version, HTTP_MOVED_TEMPORARILY, NULL, "text/html", 0, 0, squid_curtime);
+ rep->setHeaders(version, HTTP_MOVED_TEMPORARILY, NULL, "text/html", 0, 0, squid_curtime);
if (err->request) {
char *quoted_url = rfc1738_escape_part(urlCanonical(err->request));
httpHeaderPutStrf(&rep->header, HDR_X_SQUID_ERROR, "%d %s\n", err->httpStatus, "Access Denied");
} else {
MemBuf *content = errorBuildContent(err);
- httpReplySetHeaders(rep, version, err->httpStatus, NULL, "text/html", content->contentSize(), 0, squid_curtime);
+ rep->setHeaders(version, err->httpStatus, NULL, "text/html", content->contentSize(), 0, squid_curtime);
/*
* include some information for downstream caches. Implicit
* replaceable content. This isn't quite sufficient. xerrno is not
/*
- * $Id: ftp.cc,v 1.372 2005/10/18 19:10:29 serassio Exp $
+ * $Id: ftp.cc,v 1.373 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
}
/* create reply */
- reply = httpReplyCreate ();
+ reply = new HttpReply;
assert(reply != NULL);
/* create appropriate reply */
ftpAuthRequired(reply, request, realm);
- httpReplySwapOut(reply, entry);
+ reply->swapOut(entry);
fwdComplete(ftpState->fwd);
const char *filename = NULL;
const char *t = NULL;
StoreEntry *e = ftpState->entry;
- HttpReply *reply = httpReplyCreate ();
+ HttpReply *reply = new HttpReply;
if (ftpState->flags.http_header_sent)
return;
}
}
- reply = httpReplyCreate();
/* set standard stuff */
if (ftpState->restarted_offset) {
range_spec.offset = ftpState->restarted_offset;
range_spec.length = ftpState->size - ftpState->restarted_offset;
HttpVersion version(1, 0);
- httpReplySetHeaders(reply, version, HTTP_PARTIAL_CONTENT, "Gatewaying",
- mime_type, ftpState->size - ftpState->restarted_offset, ftpState->mdtm, -2);
+ reply->setHeaders(version, HTTP_PARTIAL_CONTENT, "Gatewaying",
+ mime_type, ftpState->size - ftpState->restarted_offset, ftpState->mdtm, -2);
httpHeaderAddContRange(&reply->header, range_spec, ftpState->size);
} else {
/* Full reply */
HttpVersion version(1, 0);
- httpReplySetHeaders(reply, version, HTTP_OK, "Gatewaying",
- mime_type, ftpState->size, ftpState->mdtm, -2);
+ reply->setHeaders(version, HTTP_OK, "Gatewaying",
+ mime_type, ftpState->size, ftpState->mdtm, -2);
}
/* additional info */
if (mime_enc)
httpHeaderPutStr(&reply->header, HDR_CONTENT_ENCODING, mime_enc);
- httpReplySwapOut(reply, e);
+ reply->swapOut(e);
storeTimestampsSet(e);
/* add Authenticate header */
httpHeaderPutAuth(&rep->header, "Basic", realm);
/* move new reply to the old one */
- httpReplyAbsorb(old_reply, rep);
+ old_reply->absorb(rep);
}
char *
/*
- * $Id: http.cc,v 1.464 2005/11/04 20:27:31 wessels Exp $
+ * $Id: http.cc,v 1.465 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
/* Creates a blank header. If this routine is made incremental, this will
* not do
*/
- HttpReply *reply = httpReplyCreate();
+ HttpReply *reply = new HttpReply;
Ctx ctx = ctx_enter(entry->mem_obj->url);
debug(11, 3) ("processReplyHeader: key '%s'\n",
entry->getMD5Text());
if (eof)
hdr_size = hdr_len;
else {
- httpReplyDestroy(reply);
+ delete reply;
ctx_exit(ctx);
return; /* headers not complete */
}
/* Parse headers into reply structure */
/* what happens if we fail to parse here? */
- httpReplyParse(reply, reply_hdr.buf, hdr_size);
+ reply->parse(reply_hdr.buf, hdr_size);
if (reply->sline.status >= HTTP_INVALID_HEADER) {
debugs(11, 3, "processReplyHeader: Non-HTTP-compliant header: '" << reply_hdr.buf << "'");
if (_peer)
_peer->stats.n_keepalives_recv++;
- if (Config.onoff.detect_broken_server_pconns && httpReplyBodySize(request->method, reply) == -1) {
+ if (Config.onoff.detect_broken_server_pconns && reply->bodySize(request->method) == -1) {
debug(11, 1) ("processReplyHeader: Impossible keep-alive header from '%s'\n", storeUrl(entry));
debug(11, 2) ("GOT HTTP REPLY HDR:\n---------\n%s\n----------\n", reply_hdr.buf);
flags.keepalive_broken = 1;
if (!flags.headers_parsed)
return INCOMPLETE_MSG;
- clen = httpReplyBodySize(request->method, reply);
+ clen = reply->bodySize(request->method);
/* If there is no message body, we can be persistent */
if (0 == clen)
/*
- * $Id: internal.cc,v 1.33 2005/09/17 05:50:08 wessels Exp $
+ * $Id: internal.cc,v 1.34 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 76 Internal Squid Object handling
* AUTHOR: Duane, Alex, Henrik
#endif
HttpVersion version(1, 0);
- HttpReply *reply = httpReplyCreate ();
- httpReplySetHeaders(reply,
- version,
- HTTP_NOT_FOUND,
- "Not Found",
- "text/plain",
- strlen(msgbuf),
- squid_curtime,
- -2);
- httpReplySwapOut(reply, entry);
+ HttpReply *reply = new HttpReply;
+ reply->setHeaders(version,
+ HTTP_NOT_FOUND,
+ "Not Found",
+ "text/plain",
+ strlen(msgbuf),
+ squid_curtime,
+ -2);
+ reply->swapOut(entry);
storeAppend(entry, msgbuf, strlen(msgbuf));
entry->complete();
} else {
/*
- * $Id: mime.cc,v 1.119 2005/09/17 05:50:08 wessels Exp $
+ * $Id: mime.cc,v 1.120 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
e->mem_obj->request = requestLink(r);
- HttpReply *reply = httpReplyCreate();
+ HttpReply *reply = new HttpReply;
HttpVersion version(1, 0);
- httpReplySetHeaders(reply, version, HTTP_OK, NULL,
- mimeGetContentType(icon), (int) sb.st_size, sb.st_mtime, -1);
+ reply->setHeaders(version, HTTP_OK, NULL,
+ mimeGetContentType(icon), (int) sb.st_size, sb.st_mtime, -1);
reply->cache_control = httpHdrCcCreate();
httpHeaderPutCc(&reply->header, reply->cache_control);
- httpReplySwapOut(reply, e);
+ reply->swapOut(e);
/* read the file into the buffer and append it to store */
buf = (char *)memAllocate(MEM_4K_BUF);
/*
- * $Id: net_db.cc,v 1.177 2005/07/03 15:25:08 serassio Exp $
+ * $Id: net_db.cc,v 1.178 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 38 Network Measurement Database
* AUTHOR: Duane Wessels
void
netdbBinaryExchange(StoreEntry * s)
{
- HttpReply *reply = httpReplyCreate();
+ HttpReply *reply = new HttpReply;
#if USE_ICMP
netdbEntry *n;
struct IN_ADDR addr;
storeBuffer(s);
HttpVersion version(1, 0);
- httpReplySetHeaders(reply, version, HTTP_OK, "OK",
- NULL, -1, squid_curtime, -2);
- httpReplySwapOut(reply, s);
+ reply->setHeaders(version, HTTP_OK, "OK", NULL, -1, squid_curtime, -2);
+ reply->SwapOut(s);
rec_sz = 0;
rec_sz += 1 + sizeof(addr.s_addr);
rec_sz += 1 + sizeof(int);
#else
HttpVersion version(1,0);
- httpReplySetHeaders(reply, version, HTTP_BAD_REQUEST, "Bad Request",
- NULL, -1, squid_curtime, -2);
- httpReplySwapOut(reply, s);
+ reply->setHeaders(version, HTTP_BAD_REQUEST, "Bad Request",
+ NULL, -1, squid_curtime, -2);
+ reply->swapOut(s);
storeAppendPrintf(s, "NETDB support not compiled into this Squid cache.\n");
#endif
/*
- * $Id: peer_digest.cc,v 1.104 2005/09/15 19:22:30 wessels Exp $
+ * $Id: peer_digest.cc,v 1.105 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 72 Peer Digest Routines
* AUTHOR: Alex Rousskov
HttpReply *old_rep = (HttpReply *) fetch->old_entry->getReply();
- old_rep->httpReplyUpdateOnNotModified(reply);
+ old_rep->updateOnNotModified(reply);
storeTimestampsSet(fetch->old_entry);
/*
- * $Id: store.cc,v 1.579 2005/09/10 19:31:31 serassio Exp $
+ * $Id: store.cc,v 1.580 2005/11/05 00:08:32 wessels Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
pe = storeCreateEntry(mem->url, mem->log_url, request->flags, request->method);
HttpVersion version(1, 0);
/* We are allowed to do this typecast */
- httpReplySetHeaders((HttpReply *)pe->getReply(), version, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
+ HttpReply *rep = (HttpReply *) pe->getReply(); // bypass const
+ rep->setHeaders(version, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
vary = httpHeaderGetList(&mem->getReply()->header, HDR_VARY);
if (vary.size()) {
{
Packer p;
packerToStoreInit(&p, pe);
- httpReplyPackHeadersInto(pe->getReply(), &p);
+ pe->getReply()->packHeadersInto(&p);
packerClean(&p);
}
assert (mem);
debug(20, 3) ("storeEntryReset: %s\n", storeUrl(e));
mem->reset();
- httpReplyReset((HttpReply *)e->getReply());
+ HttpReply *rep = (HttpReply *) e->getReply(); // bypass const
+ rep->reset();
e->expires = e->lastmod = e->timestamp = -1;
}
myrep = (HttpReply *)e->getReply(); /* we are allowed to do this */
/* move info to the mem_obj->reply */
- httpReplyAbsorb(myrep, rep);
+ myrep->absorb(rep);
/* TODO: when we store headers serparately remove the header portion */
/* TODO: mark the length of the headers ? */
assert (e->isEmpty());
- httpReplyPackHeadersInto(e->getReply(), &p);
+ e->getReply()->packHeadersInto(&p);
myrep->hdr_sz = e->mem_obj->endOffset();
/*
- * $Id: store_client.cc,v 1.142 2005/09/30 22:24:21 wessels Exp $
+ * $Id: store_client.cc,v 1.143 2005/11/05 00:08:33 wessels Exp $
*
* DEBUG: section 90 Storage Manager Client-Side Interface
* AUTHOR: Duane Wessels
assert(sc->_callback.pending());
debug(90, 3)("storeClientReadBody: len %d", (int) len);
- if (sc->copyInto.offset == 0 && len > 0 && sc->entry->getReply()->sline.status == 0)
+ if (sc->copyInto.offset == 0 && len > 0 && sc->entry->getReply()->sline.status == 0) {
/* Our structure ! */
- if (!httpReplyParse((HttpReply *)sc->entry->getReply(), sc->copyInto.data, headersEnd(sc->copyInto.data, len))) {
+ HttpReply *rep = (HttpReply *) sc->entry->getReply(); // bypass const
+
+ if (!rep->parse(sc->copyInto.data, headersEnd(sc->copyInto.data, len))) {
debug (90,0)("Could not parse headers from on disk object\n");
}
+ }
sc->callback(len);
}
(int) copy_sz);
xmemmove(copyInto.data, copyInto.data + mem->swap_hdr_sz, copy_sz);
- if (copyInto.offset == 0 && len > 0 && entry->getReply()->sline.status == 0)
+ if (copyInto.offset == 0 && len > 0 && entry->getReply()->sline.status == 0) {
/* Our structure ! */
- if (!httpReplyParse((HttpReply *)entry->getReply(), copyInto.data,
- headersEnd(copyInto.data, copy_sz))) {
+ HttpReply *rep = (HttpReply *) entry->getReply(); // bypass const
+
+ if (!rep->parse(copyInto.data, headersEnd(copyInto.data, copy_sz))) {
debug (90,0)("could not parse headers from on disk structure!\n");
}
+ }
callback(copy_sz);
return;
/*
- * $Id: store_digest.cc,v 1.59 2005/01/03 16:08:26 robertc Exp $
+ * $Id: store_digest.cc,v 1.60 2005/11/05 00:08:33 wessels Exp $
*
* DEBUG: section 71 Store Digest Manager
* AUTHOR: Alex Rousskov
/* setting public key will purge old digest entry if any */
storeSetPublicKey(e);
/* fake reply */
- HttpReply *rep = httpReplyCreate ();
+ HttpReply *rep = new HttpReply;
HttpVersion version(1, 0);
- httpReplySetHeaders(rep, version, HTTP_OK, "Cache Digest OK",
- "application/cache-digest", store_digest->mask_size + sizeof(sd_state.cblock),
- squid_curtime, squid_curtime + Config.digest.rewrite_period);
+ rep->setHeaders(version, HTTP_OK, "Cache Digest OK",
+ "application/cache-digest", store_digest->mask_size + sizeof(sd_state.cblock),
+ squid_curtime, squid_curtime + Config.digest.rewrite_period);
debug(71, 3) ("storeDigestRewrite: entry expires on %ld (%+d)\n",
(long int) rep->expires, (int) (rep->expires - squid_curtime));
storeBuffer(e);
- httpReplySwapOut(rep, e);
+ rep->swapOut(e);
storeDigestCBlockSwapOut(e);
storeBufferFlush(e);
eventAdd("storeDigestSwapOutStep", storeDigestSwapOutStep, sd_state.rewrite_lock, 0.0, 1);
/*
- * $Id: urn.cc,v 1.90 2005/09/17 05:50:08 wessels Exp $
+ * $Id: urn.cc,v 1.91 2005/11/05 00:08:33 wessels Exp $
*
* DEBUG: section 52 URN Parsing
* AUTHOR: Kostas Anagnostakis
s = buf + k;
assert(urlres_e->getReply());
- rep = httpReplyCreate ();
- httpReplyParse(rep, buf, k);
+ rep = new HttpReply;
+ rep->parse(buf, k);
debug(52, 3) ("reply exists, code=%d.\n",
rep->sline.status);
err->request = requestLink(urnState->request);
err->url = xstrdup(storeUrl(e));
errorAppendEntry(e, err);
- httpReplyDestroy(rep);
+ delete rep;
goto error;
}
- httpReplyDestroy(rep);
+ delete rep;
while (xisspace(*s))
s++;
"Generated by %s@%s\n"
"</ADDRESS>\n",
full_appname_string, getMyHostname());
- rep = httpReplyCreate();
- httpReplySetHeaders(rep, version, HTTP_MOVED_TEMPORARILY, NULL,
- "text/html", mb->contentSize(), 0, squid_curtime);
+ rep = new HttpReply;
+ rep->setHeaders(version, HTTP_MOVED_TEMPORARILY, NULL,
+ "text/html", mb->contentSize(), 0, squid_curtime);
if (urnState->flags.force_menu) {
debug(51, 3) ("urnHandleReply: forcing menu\n");
httpBodySet(&rep->body, mb);
/* don't clean or delete mb; rep->body owns it now */
- httpReplySwapOut(rep, e);
+ rep->swapOut(e);
e->complete();
for (i = 0; i < urlcnt; i++) {
/*
- * $Id: whois.cc,v 1.30 2005/09/10 19:31:31 serassio Exp $
+ * $Id: whois.cc,v 1.31 2005/11/05 00:08:33 wessels Exp $
*
* DEBUG: section 75 WHOIS protocol
* AUTHOR: Duane Wessels, Kostas Anagnostakis
void
WhoisState::setReplyToOK(StoreEntry *entry)
{
- HttpReply *reply = httpReplyCreate();
+ HttpReply *reply = new HttpReply;
storeBuffer(entry);
HttpVersion version(1, 0);
- httpReplySetHeaders(reply, version, HTTP_OK, "Gatewaying", "text/plain", -1, -1, -2);
+ reply->setHeaders(version, HTTP_OK, "Gatewaying", "text/plain", -1, -1, -2);
storeEntryReplaceObject (entry, reply);
}