]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Message.cc
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 93 Adaptation */
12 #include "adaptation/Message.h"
13 #include "base/TextException.h"
16 Adaptation::Message::Message(): header(NULL
)
20 Adaptation::Message::Message(Header
*aHeader
): header(NULL
)
25 Adaptation::Message::~Message()
31 Adaptation::Message::clear()
33 HTTPMSGUNLOCK(header
);
38 Adaptation::Message::set(Header
*aHeader
)
44 body_pipe
= header
->body_pipe
;
49 Adaptation::Message::ShortCircuit(Message
&src
, Message
&dest
)
51 Must(!dest
.header
); // the message is not "used"
52 Must(!dest
.body_pipe
); // can relax if needed, but need !body_pipe->used()
53 Must(src
.header
); // or there is nothing to shortcircuit
55 if (src
.header
->body_pipe
!= NULL
) {
56 // check that it would not be too late to shortcircuit the pipe
57 Must(!src
.header
->body_pipe
->consumedSize());
58 src
.header
->body_pipe
->clearConsumer(); // if any
59 // note: current header->body_pipe producer may later become
60 // dest.body_pipe consumer and consume its own data
61 // TODO: consumer should detect and bypass short-circuit adaptation
63 dest
.set(src
.header
->clone());