]>
Commit | Line | Data |
---|---|---|
774c051c | 1 | /* |
bbc27441 | 2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors |
774c051c | 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. | |
774c051c | 7 | */ |
8 | ||
5f8252d2 | 9 | #ifndef SQUID_ICAPINOUT_H |
10 | #define SQUID_ICAPINOUT_H | |
774c051c | 11 | |
12 | #include "HttpMsg.h" | |
d9eb9082 | 13 | #include "HttpReply.h" |
602d9612 | 14 | #include "HttpRequest.h" |
774c051c | 15 | |
5f8252d2 | 16 | // IcapInOut manages a pointer to the HTTP message being worked on. |
26ac0430 AJ |
17 | // For HTTP responses, request header information is also available |
18 | // as the "cause". ICAP transactions use this class to store virgin | |
5f8252d2 | 19 | // and adapted HTTP messages. |
774c051c | 20 | |
af6a12ee AJ |
21 | namespace Adaptation |
22 | { | |
e1381638 AJ |
23 | namespace Icap |
24 | { | |
26cc52cb AR |
25 | |
26 | class InOut | |
774c051c | 27 | { |
28 | ||
29 | public: | |
5f8252d2 | 30 | typedef HttpMsg Header; |
774c051c | 31 | |
26cc52cb | 32 | InOut(): header(0), cause(0) {} |
5f8252d2 | 33 | |
26cc52cb | 34 | ~InOut() { |
6dd9f4bd | 35 | HTTPMSGUNLOCK(cause); |
36 | HTTPMSGUNLOCK(header); | |
c99de607 | 37 | } |
774c051c | 38 | |
26ac0430 | 39 | void setCause(HttpRequest *r) { |
c99de607 | 40 | if (r) { |
41 | HTTPMSGUNLOCK(cause); | |
b248c2a3 AJ |
42 | cause = r; |
43 | HTTPMSGLOCK(cause); | |
c99de607 | 44 | } else { |
45 | assert(!cause); | |
46 | } | |
47 | } | |
d9eb9082 | 48 | |
26ac0430 | 49 | void setHeader(Header *h) { |
6dd9f4bd | 50 | HTTPMSGUNLOCK(header); |
b248c2a3 AJ |
51 | header = h; |
52 | HTTPMSGLOCK(header); | |
26ac0430 | 53 | body_pipe = header->body_pipe; |
c99de607 | 54 | } |
d9eb9082 | 55 | |
774c051c | 56 | public: |
5f8252d2 | 57 | // virgin or adapted message being worked on |
774c051c | 58 | Header *header; // parsed HTTP status/request line and headers |
774c051c | 59 | |
5f8252d2 | 60 | // HTTP request header for HTTP responses (the cause of the response) |
774c051c | 61 | HttpRequest *cause; |
d9eb9082 | 62 | |
26ac0430 AJ |
63 | // Copy of header->body_pipe, in case somebody moves the original. |
64 | BodyPipe::Pointer body_pipe; | |
774c051c | 65 | }; |
66 | ||
5f8252d2 | 67 | // TODO: s/Header/Message/i ? |
68 | ||
26cc52cb AR |
69 | } // namespace Icap |
70 | } // namespace Adaptation | |
71 | ||
5f8252d2 | 72 | #endif /* SQUID_ICAPINOUT_H */ |