]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/Request.cc
Use ERR_ACCESS_DENIED for HTTP 403 (Forbidden) errors (#1899)
[thirdparty/squid.git] / src / mgr / Request.cc
1 /*
2 * Copyright (C) 1996-2023 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 "comm/Connection.h"
14 #include "ipc/Messages.h"
15 #include "ipc/TypedMsgHdr.h"
16 #include "mgr/ActionParams.h"
17 #include "mgr/Request.h"
18
19 Mgr::Request::Request(const int aRequestorId,
20 const Ipc::RequestId aRequestId,
21 const Comm::ConnectionPointer &aConn,
22 const ActionParams &aParams):
23 Ipc::Request(aRequestorId, aRequestId),
24 conn(aConn),
25 params(aParams)
26 {
27 Must(requestorId > 0);
28 }
29
30 Mgr::Request::Request(const Ipc::TypedMsgHdr &msg)
31 {
32 msg.checkType(Ipc::mtCacheMgrRequest);
33 msg.getPod(requestorId);
34 msg.getPod(requestId);
35 params = ActionParams(msg);
36
37 conn = new Comm::Connection;
38 conn->fd = msg.getFd();
39 // For now we just have the FD.
40 // Address and connectio details wil be pulled/imported by the component later
41 }
42
43 void
44 Mgr::Request::pack(Ipc::TypedMsgHdr& msg) const
45 {
46 msg.setType(Ipc::mtCacheMgrRequest);
47 msg.putPod(requestorId);
48 msg.putPod(requestId);
49 params.pack(msg);
50
51 msg.putFd(conn->fd);
52 }
53
54 Ipc::Request::Pointer
55 Mgr::Request::clone() const
56 {
57 return new Request(*this);
58 }
59