]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/helper/Reply.h
2 * Copyright (C) 1996-2014 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 #ifndef _SQUID_SRC_HELPER_REPLY_H
10 #define _SQUID_SRC_HELPER_REPLY_H
12 #include "base/CbcPointer.h"
13 #include "helper/forward.h"
14 #include "helper/ResultCode.h"
24 * This object stores the reply message from a helper lookup
25 * It provides parser routing to accept a raw buffer and process the
26 * helper reply into fields for easy access by callers
31 // copy are prohibited for now
32 Reply(const Helper::Reply
&r
);
33 Reply
&operator =(const Helper::Reply
&r
);
36 explicit Reply(Helper::ResultCode res
= Helper::Unknown
) : result(res
), notes(), whichServer(NULL
) {
41 // create/parse details from the msg buffer provided
42 // XXX: buf should be const but parse() needs non-const for now
43 Reply(char *buf
, size_t len
);
45 const MemBuf
&other() const { return other_
; }
47 /// backward compatibility:
48 /// access to modifiable blob, required by redirectHandleReply()
49 /// and by urlParse() in ClientRequestContext::clientRedirectDone()
50 /// and by token blob/arg parsing in Negotiate auth handler
51 MemBuf
&modifiableOther() const { return *const_cast<MemBuf
*>(&other_
); }
53 /** parse a helper response line format:
54 * line := [ result ] *#( kv-pair )
55 * kv-pair := OWS token '=' ( quoted-string | token )
57 * token are URL-decoded.
58 * quoted-string are \-escape decoded and the quotes are stripped.
60 // XXX: buf should be const but we may need strwordtok() and rfc1738_unescape()
61 void parse(char *buf
, size_t len
);
64 /// The helper response 'result' field.
65 Helper::ResultCode result
;
67 // list of key=value pairs the helper produced
70 /// for stateful replies the responding helper 'server' needs to be preserved across callbacks
71 CbcPointer
<helper_stateful_server
> whichServer
;
74 void parseResponseKeys();
76 /// the remainder of the line
82 std::ostream
&operator <<(std::ostream
&os
, const Helper::Reply
&r
);
84 #endif /* _SQUID_SRC_HELPER_REPLY_H */