]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/ActionParams.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / mgr / ActionParams.cc
1 /*
2 * Copyright (C) 1996-2021 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 16 Cache Manager API */
10
11 #include "squid.h"
12 #include "base/TextException.h"
13 #include "ipc/TypedMsgHdr.h"
14 #include "mgr/ActionParams.h"
15 #include "sbuf/StringConvert.h"
16
17 Mgr::ActionParams::ActionParams(): httpMethod(Http::METHOD_NONE)
18 {
19 }
20
21 Mgr::ActionParams::ActionParams(const Ipc::TypedMsgHdr &msg)
22 {
23 msg.getString(httpUri);
24
25 String method;
26 msg.getString(method);
27 httpMethod.HttpRequestMethodXXX(method.termedBuf());
28
29 msg.getPod(httpFlags);
30 msg.getString(httpOrigin);
31
32 msg.getString(actionName);
33 msg.getString(userName);
34 msg.getString(password);
35 queryParams.unpack(msg);
36 }
37
38 void
39 Mgr::ActionParams::pack(Ipc::TypedMsgHdr &msg) const
40 {
41 msg.putString(httpUri);
42 auto foo = SBufToString(httpMethod.image());
43 msg.putString(foo);
44 msg.putPod(httpFlags);
45 msg.putString(httpOrigin);
46
47 msg.putString(actionName);
48 msg.putString(userName);
49 msg.putString(password);
50 queryParams.pack(msg);
51 }
52