Message.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
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.
7  */
8 
9 /* DEBUG: section 93 Adaptation */
10 
11 #include "squid.h"
12 #include "adaptation/Message.h"
13 #include "base/TextException.h"
14 #include "BodyPipe.h"
15 #include "http/Message.h"
16 
18 {
19 }
20 
22 {
23  set(aHeader);
24 }
25 
27 {
28  clear();
29 }
30 
31 void
33 {
34  HTTPMSGUNLOCK(header);
35  body_pipe = NULL;
36 }
37 
38 void
40 {
41  clear();
42  if (aHeader) {
43  header = aHeader;
44  HTTPMSGLOCK(header);
45  body_pipe = header->body_pipe;
46  }
47 }
48 
49 void
51 {
52  Must(!dest.header); // the message is not "used"
53  Must(!dest.body_pipe); // can relax if needed, but need !body_pipe->used()
54  Must(src.header); // or there is nothing to shortcircuit
55 
56  if (src.header->body_pipe != NULL) {
57  // check that it would not be too late to shortcircuit the pipe
59  src.header->body_pipe->clearConsumer(); // if any
60  // note: current header->body_pipe producer may later become
61  // dest.body_pipe consumer and consume its own data
62  // TODO: consumer should detect and bypass short-circuit adaptation
63  }
64  dest.set(src.header->clone());
65 }
66 
static void ShortCircuit(Message &src, Message &dest)
Definition: Message.cc:50
void set(Header *aHeader)
Definition: Message.cc:39
void HTTPMSGLOCK(Http::Message *a)
Definition: Message.h:154
uint64_t consumedSize() const
Definition: BodyPipe.h:111
common parts of HttpRequest and HttpReply
Definition: Message.h:24
#define Must(cond)
Definition: TextException.h:89
BodyPipePointer body_pipe
Definition: Message.h:46
virtual Http::Message * clone() const =0
BodyPipe::Pointer body_pipe
optional pipeline to receive message body
Definition: Message.h:97
void clearConsumer()
Definition: BodyPipe.cc:254
#define NULL
Definition: types.h:166
void HTTPMSGUNLOCK(Http::Message *a)
Definition: Message.h:144
Header * header
Definition: Message.h:42

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors