]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/Action.cc
4 * DEBUG: section 16 Cache Manager API
11 #include "mgr/ActionCreator.h"
12 #include "mgr/Action.h"
13 #include "mgr/ActionParams.h"
14 #include "mgr/ActionProfile.h"
15 #include "mgr/Command.h"
16 #include "mgr/Request.h"
17 #include "mgr/Response.h"
18 #include "SquidTime.h"
22 Mgr::Action::Action(const Command::Pointer
&aCmd
): cmd(aCmd
)
25 Must(cmd
->profile
!= NULL
);
28 Mgr::Action::~Action()
33 Mgr::Action::command() const
40 Mgr::Action::atomic() const
42 return command().profile
->isAtomic
;
46 Mgr::Action::name() const
48 return command().profile
->name
;
52 Mgr::Action::createStoreEntry() const
54 const ActionParams
¶ms
= command().params
;
55 const char *uri
= params
.httpUri
.termedBuf();
56 return storeCreateEntry(uri
, uri
, params
.httpFlags
, params
.httpMethod
);
60 Mgr::Action::add(const Action
& action
)
65 Mgr::Action::respond(const Request
& request
)
69 // Assume most kid classes are fully aggregatable (i.e., they do not dump
70 // local info at all). Do not import the remote HTTP fd into our Comm
71 // space; collect and send an IPC msg with collected info to Coordinator.
74 sendResponse(request
.requestId
);
78 Mgr::Action::sendResponse(unsigned int requestId
)
80 Response
response(requestId
, this);
81 Ipc::TypedMsgHdr message
;
82 response
.pack(message
);
83 Ipc::SendMessage(Ipc::coordinatorAddr
, message
);
87 Mgr::Action::run(StoreEntry
* entry
, bool writeHttpHeader
)
91 fillEntry(entry
, writeHttpHeader
);
95 Mgr::Action::fillEntry(StoreEntry
* entry
, bool writeHttpHeader
)
100 if (writeHttpHeader
) {
101 HttpReply
*rep
= new HttpReply
;
102 rep
->setHeaders(HTTP_OK
, NULL
, "text/plain", -1, squid_curtime
, squid_curtime
);
103 entry
->replaceHttpReply(rep
);