]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Message.cc
2 * DEBUG: section 93 Adaptation
6 #include "adaptation/Message.h"
7 #include "base/TextException.h"
10 Adaptation::Message::Message(): header(NULL
)
14 Adaptation::Message::Message(Header
*aHeader
): header(NULL
)
19 Adaptation::Message::~Message()
25 Adaptation::Message::clear()
27 HTTPMSGUNLOCK(header
);
32 Adaptation::Message::set(Header
*aHeader
)
36 header
= HTTPMSGLOCK(aHeader
);
37 body_pipe
= header
->body_pipe
;
42 Adaptation::Message::ShortCircuit(Message
&src
, Message
&dest
)
44 Must(!dest
.header
); // the message is not "used"
45 Must(!dest
.body_pipe
); // can relax if needed, but need !body_pipe->used()
46 Must(src
.header
); // or there is nothing to shortcircuit
48 if (src
.header
->body_pipe
!= NULL
) {
49 // check that it would not be too late to shortcircuit the pipe
50 Must(!src
.header
->body_pipe
->consumedSize());
51 src
.header
->body_pipe
->clearConsumer(); // if any
52 // note: current header->body_pipe producer may later become
53 // dest.body_pipe consumer and consume its own data
54 // TODO: consumer should detect and bypass short-circuit adaptation
56 dest
.set(src
.header
->clone());