]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/Action.cc
4 * DEBUG: section 16 Cache Manager API
9 #include "comm/Connection.h"
10 #include "HttpReply.h"
12 #include "mgr/ActionCreator.h"
13 #include "mgr/Action.h"
14 #include "mgr/ActionParams.h"
15 #include "mgr/ActionProfile.h"
16 #include "mgr/Command.h"
17 #include "mgr/Request.h"
18 #include "mgr/Response.h"
19 #include "SquidTime.h"
23 Mgr::Action::Action(const Command::Pointer
&aCmd
): cmd(aCmd
)
26 Must(cmd
->profile
!= NULL
);
29 Mgr::Action::~Action()
34 Mgr::Action::command() const
41 Mgr::Action::atomic() const
43 return command().profile
->isAtomic
;
47 Mgr::Action::name() const
49 return command().profile
->name
;
53 Mgr::Action::createStoreEntry() const
55 const ActionParams
¶ms
= command().params
;
56 const char *uri
= params
.httpUri
.termedBuf();
57 return storeCreateEntry(uri
, uri
, params
.httpFlags
, params
.httpMethod
);
61 Mgr::Action::add(const Action
& action
)
66 Mgr::Action::respond(const Request
& request
)
70 // Assume most kid classes are fully aggregatable (i.e., they do not dump
71 // local info at all). Do not import the remote HTTP fd into our Comm
72 // space; collect and send an IPC msg with collected info to Coordinator.
73 request
.conn
->close();
75 sendResponse(request
.requestId
);
79 Mgr::Action::sendResponse(unsigned int requestId
)
81 Response
response(requestId
, this);
82 Ipc::TypedMsgHdr message
;
83 response
.pack(message
);
84 Ipc::SendMessage(Ipc::coordinatorAddr
, message
);
88 Mgr::Action::run(StoreEntry
* entry
, bool writeHttpHeader
)
92 fillEntry(entry
, writeHttpHeader
);
96 Mgr::Action::fillEntry(StoreEntry
* entry
, bool writeHttpHeader
)
101 if (writeHttpHeader
) {
102 HttpReply
*rep
= new HttpReply
;
103 rep
->setHeaders(HTTP_OK
, NULL
, "text/plain", -1, squid_curtime
, squid_curtime
);
104 entry
->replaceHttpReply(rep
);