/* put */
addEntry(new HttpHeaderEntry(HDR_CACHE_CONTROL, NULL, mb.buf));
/* cleanup */
- packerClean(&p);
mb.clean();
}
/* put */
addEntry(new HttpHeaderEntry(HDR_CONTENT_RANGE, NULL, mb.buf));
/* cleanup */
- packerClean(&p);
mb.clean();
}
/* put */
addEntry(new HttpHeaderEntry(HDR_RANGE, NULL, mb.buf));
/* cleanup */
- packerClean(&p);
mb.clean();
}
/* put */
addEntry(new HttpHeaderEntry(HDR_SURROGATE_CONTROL, NULL, mb.buf));
/* cleanup */
- packerClean(&p);
mb.clean();
}
Packer p;
packerToMemInit(&p, &mb);
packFirstLineInto(&p, true);
- packerClean(&p);
}
mb->init();
packerToMemInit(&p, mb);
packInto(&p);
- packerClean(&p);
return mb;
}
assert(e);
packerToStoreInit(&p, e);
pack(&p);
- packerClean(&p);
}
/* packs request-line and headers, appends <crlf> terminator */
p->real_handler = mb;
}
-/* call this when you are done */
-void
-packerClean(Packer * p)
+Packer::~Packer()
{
- assert(p);
-
- if (p->append == (append_f) store_append && p->real_handler)
- static_cast<StoreEntry*>(p->real_handler)->flush();
+ if (append == (append_f) store_append && real_handler)
+ static_cast<StoreEntry*>(real_handler)->flush();
/* it is not really necessary to do this, but, just in case... */
- p->append = NULL;
- p->packer_vprintf = NULL;
- p->real_handler = NULL;
+ append = NULL;
+ packer_vprintf = NULL;
+ real_handler = NULL;
}
void
{
public:
+ virtual ~Packer();
+
/* protected, use interface functions instead */
append_f append;
vprintf_f packer_vprintf;
void *real_handler; /* first parameter to real append and vprintf */
};
-void packerClean(Packer * p);
void packerAppend(Packer * p, const char *buf, int size);
void packerPrintf(Packer * p, const char *fmt,...) PRINTF_FORMAT_ARG2;
Packer p;
packerToMemInit(&p, &mb);
theMessage.packInto(&p, true);
- packerClean(&p);
return Area::FromTempBuffer(mb.content(), mb.contentSize());
}
reply_->header.packInto(&p);
al.headers.reply = xstrdup(mb.buf);
- packerClean(&p);
mb.clean();
}
prepareLogWithRequestDetails(adapted_request_, alep);
Packer p;
packerToMemInit(&p, &httpBuf);
head->packInto(&p, true);
- packerClean(&p);
}
// decides whether to offer a preview and calculates its size
assert(aLogEntry != NULL);
if (Config.onoff.log_mime_hdrs) {
- Packer p;
MemBuf mb;
mb.init();
- packerToMemInit(&p, &mb);
- request->header.packInto(&p);
+ Packer pa;
+ packerToMemInit(&pa, &mb);
+ request->header.packInto(&pa);
//This is the request after adaptation or redirection
aLogEntry->headers.adapted_request = xstrdup(mb.buf);
// the virgin request is saved to aLogEntry->request
if (aLogEntry->request) {
- packerClean(&p);
+ Packer p;
mb.reset();
packerToMemInit(&p, &mb);
aLogEntry->request->header.packInto(&p);
#if USE_ADAPTATION
const Adaptation::History::Pointer ah = request->adaptLogHistory();
if (ah != NULL) {
- packerClean(&p);
+ Packer p;
mb.reset();
packerToMemInit(&p, &mb);
ah->lastMeta.packInto(&p);
}
#endif
- packerClean(&p);
mb.clean();
}
hdr.packInto(&p);
- packerClean(&p);
-
hdr.clean();
/* append <crlf> (we packed a header, not a reply) */
request->http_ver.major, request->http_ver.minor);
packerToMemInit(&pck, &str);
request->header.packInto(&pck);
- packerClean(&pck);
}
str.Printf("\r\n");
request->http_ver.major, request->http_ver.minor);
packerToMemInit(&pck, &mb);
request->header.packInto(&pck, true); //hide authorization data
- packerClean(&pck);
} else if (request_hdrs) {
p = request_hdrs;
} else {
{
static char pkt[8192];
HttpHeader hdr(hoHtcpReply);
- MemBuf mb;
- Packer p;
ssize_t pktlen;
htcpStuff stuff(dhdr->msg_id, HTCP_TST, RR_RESPONSE, 0);
debugs(31, 3, "htcpTstReply: response = " << stuff.response);
if (spec) {
+ MemBuf mb;
mb.init();
+ Packer p;
packerToMemInit(&p, &mb);
stuff.S.method = spec->method;
stuff.S.uri = spec->uri;
debugs(31, 3, "htcpTstReply: cache_hdrs = {" << stuff.D.cache_hdrs << "}");
mb.clean();
hdr.clean();
- packerClean(&p);
}
pktlen = htcpBuildPacket(pkt, sizeof(pkt), &stuff);
ssize_t pktlen;
char vbuf[32];
HttpHeader hdr(hoRequest);
- Packer pa;
- MemBuf mb;
HttpStateFlags flags;
if (!Comm::IsConnOpen(htcpIncomingConn))
stuff.S.uri = (char *) e->url();
stuff.S.version = vbuf;
HttpStateData::httpBuildRequestHeader(req, e, NULL, &hdr, flags);
+ MemBuf mb;
mb.init();
+ Packer pa;
packerToMemInit(&pa, &mb);
hdr.packInto(&pa);
hdr.clean();
- packerClean(&pa);
stuff.S.req_hdrs = mb.buf;
pktlen = htcpBuildPacket(pkt, sizeof(pkt), &stuff);
mb.clean();
ssize_t pktlen;
char vbuf[32];
HttpHeader hdr(hoRequest);
- Packer pa;
MemBuf mb;
HttpStateFlags flags;
if (reason != HTCP_CLR_INVALIDATION) {
HttpStateData::httpBuildRequestHeader(req, e, NULL, &hdr, flags);
mb.init();
+ Packer pa;
packerToMemInit(&pa, &mb);
hdr.packInto(&pa);
hdr.clean();
- packerClean(&pa);
stuff.S.req_hdrs = mb.buf;
} else {
stuff.S.req_hdrs = NULL;
packerToMemInit(&p, mb);
hdr.packInto(&p);
hdr.clean();
- packerClean(&p);
}
/* append header terminator */
mb->append(crlf, 2);
mb.init();
packerToMemInit(&p, &mb);
request->pack(&p);
- packerClean(&p);
debugs(9, 2, "FTP Client " << clientConnection);
debugs(9, 2, "FTP Client REQUEST:\n---------\n" << mb.buf <<
EBIT_CLR(flags, ENTRY_FWD_HDR_WAIT);
rep->body.packInto(&p);
-
- packerClean(&p);
}
char const *
Packer p;
packerToStoreInit(&p, pe);
pe->getReply()->packHeadersInto(&p);
- packerClean(&p);
}
pe->flush();
Packer p;
packerToStoreInit(&p, pe);
pe->getReply()->packHeadersInto(&p);
- packerClean(&p);
}
pe->flush();
packerToMemInit(&p, &mb);
(*pm) (obj, &p);
debugs(section, level, "" << label << "" << mb.buf << "");
- packerClean(&p);
mb.clean();
}
packerToMemInit(&p, &mb);
hdr_out.packInto(&p);
hdr_out.clean();
- packerClean(&p);
mb.append("\r\n", 2);
debugs(11, 2, "Tunnel Server REQUEST: " << tunnelState->server.conn << ":\n----------\n" <<