]>
Commit | Line | Data |
---|---|---|
cb69b4c7 | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
e25c139f | 3 | * |
bbc27441 AJ |
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. | |
cb69b4c7 | 7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 56 HTTP Message Body */ |
10 | ||
582c2af2 | 11 | #include "squid.h" |
0521f8be | 12 | #include "HttpBody.h" |
0eb49b6d | 13 | #include "MemBuf.h" |
cb69b4c7 | 14 | |
0521f8be FC |
15 | HttpBody::HttpBody() : mb(new MemBuf) |
16 | {} | |
17 | ||
18 | HttpBody::~HttpBody() | |
cb69b4c7 | 19 | { |
54544731 | 20 | delete mb; |
cb69b4c7 | 21 | } |
22 | ||
23 | void | |
0521f8be | 24 | HttpBody::clear() |
cb69b4c7 | 25 | { |
6797fcb1 | 26 | mb->clean(); |
cb69b4c7 | 27 | } |
28 | ||
1d21d91d | 29 | /* set body by absorbing mb */ |
cb69b4c7 | 30 | void |
0521f8be | 31 | HttpBody::setMb(MemBuf * mb_) |
cb69b4c7 | 32 | { |
0521f8be FC |
33 | delete mb; |
34 | /* note: protection against assign-to-self is not needed | |
35 | * as MemBuf doesn't have a copy-constructor. If such a constructor | |
36 | * is ever added, add such protection here. | |
37 | */ | |
f53969cc | 38 | mb = mb_; /* absorb */ |
cb69b4c7 | 39 | } |
40 | ||
41 | void | |
17802cf1 | 42 | HttpBody::packInto(Packable * p) const |
cb69b4c7 | 43 | { |
0521f8be | 44 | assert(p); |
62e76326 | 45 | |
0521f8be | 46 | if (mb->contentSize()) |
785b508d | 47 | p->append(mb->content(), mb->contentSize()); |
cb69b4c7 | 48 | } |
f53969cc | 49 |